2012-01-28 2 views
0

SIGABITエラー:ロードPDF - 私はiPadのストレージ上の私のpdfファイルのアンドレスでURLを持って

/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/78AB0683-5B3F-4AD6-83BB-236D9623574B/Library/Caches/Newsstand/953C71E3-CED3-4369-993F-9132119269EC/ 

は、その後、私はこれがNSURLにアンドレス入れWICHする機能を持っている:

-(void)readIssue:(Issue *)issue { 
    urlOfReadingIssue=[[issue contentURL] URLByAppendingPathComponent:@"magazine.pdf"]; 

このコードの上に、このURLからこのファイルを読み込むためのVFR-Readerコードがあります。リーダーのデモから元のコードは次のとおりです。

-(void)readIssue:(Issue *)issue { 

urlOfReadingIssue=[[issue contentURL] URLByAppendingPathComponent:@"magazine.pdf"]; 


NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files) 

    NSString *filePath = urlOfReadingIssue; 

    ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath 
                  password:phrase]; 

    if (document != nil) // Must have a valid ReaderDocument object in order to proceed with things 
    { 
     ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; 

     readerViewController.delegate = self; // Set the ReaderViewController delegate to self 

#if (DEMO_VIEW_CONTROLLER_PUSH == TRUE) 

     [self.navigationController pushViewController:readerViewController animated:YES]; 

#else // present in a modal view controller 

     readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
     readerViewController.modalPresentationStyle = UIModalPresentationFullScreen; 

     [self presentModalViewController:readerViewController animated:YES]; 

#endif // DEMO_VIEW_CONTROLLER_PUSH 

     [readerViewController release]; // Release the ReaderViewController 
    } 

しかし、私はビルドするとき、私は@autoreleasepoolにAppDelegate.mにスレッド・エラー "SIGABIT" を得る:

NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files) 

NSArray *pdfs = [[NSBundle mainBundle] pathsForResourcesOfType:@"pdf" inDirectory:nil]; 

NSString *filePath = [pdfs lastObject]; assert(filePath != nil); // Path to last PDF file 

ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:phrase]; 

if (document != nil) // Must have a valid ReaderDocument object in order to proceed with things 
{ 
    ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; 

    readerViewController.delegate = self; // Set the ReaderViewController delegate to self 

    if (DEMO_VIEW_CONTROLLER_PUSH == TRUE) 

    [self.navigationController pushViewController:readerViewController animated:YES]; 

#else // present in a modal view controller 

    readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    readerViewController.modalPresentationStyle = UIModalPresentationFullScreen; 

    [self presentModalViewController:readerViewController animated:YES]; 

    #endif // DEMO_VIEW_CONTROLLER_PUSH 

    [readerViewController release]; // Release the ReaderViewController 
} 

私の最終的なコードがある

int main(int argc, char *argv[]) 
{ 
    @autoreleasepool { 
     return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 
    } 
} 

ここで何が起こっているのかわかりません。 googleで検索すると、私はこのエラーについて読んでいます。 "SIGABRT"はxcodeのエラーと思われます。

私は数時間それを持っています、私はVFR-Readerのより多くの経験を持つ人がこのエラーについて私を最も良く導くことができたらうれしいです。

+2

12の質問をし、回答を受け入れていないことに注意してください。これは、人々があなたの質問に答えることを躊躇させるかもしれません。 – Bobrovsky

+0

あなたはそれがSIGABITではなく、SIGABITだと確信していますか? –

+0

申し訳ありませんが、本当にSIGABRTです。私はその質問を編集した。 –

答えて

0

この

NSString *filePath = [urlOfReadingIssue path]; 

だけではなく

NSString *filePath = urlOfReadingIssue; 

直接NSStringNSUrlを割り当てること、この問題をもたらす可能性を試してみてください。私はこれが正常に動作と思う

  - (void)handleSingleTap:(UITapGestureRecognizer *)recognizer 
     { 
     [self seeYou:@"Complete Book-02"]; 
     } 

     -(void)seeYou:(NSString *)filename 
     { 
      NSString *phrase = nil; 
     NSString *file1=[[NSBundle mainBundle]pathForResource:filename ofType:@"pdf"]; 
    ReaderDocument *document = [ReaderDocument withDocumentFilePath:file1 password:phrase]; 
    if (document != nil) 
    { 
    ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; 
    readerViewController.delegate = self; 

      #if (DEMO_VIEW_CONTROLLER_PUSH == TRUE) 

    [self.navigationController pushViewController:readerViewController animated:YES]; 

      #else 
    readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    readerViewController.modalPresentationStyle = UIModalPresentationFullScreen; 
    [self presentModalViewController:readerViewController animated:YES]; 

      #endif 

    [readerViewController release];  
     } 

     } 

- (void)dismissReaderViewController:(ReaderViewController *)viewController 
{ 
#ifdef DEBUGX 
    NSLog(@"%s", __FUNCTION__); 
#endif 

#if (DEMO_VIEW_CONTROLLER_PUSH == TRUE) 

    [self.navigationController popViewControllerAnimated:YES]; 

#else // dismiss the modal view controller 

    [self dismissModalViewControllerAnimated:YES]; 

#endif // DEMO_VIEW_CONTROLLER_PUSH 
} 
0

を参照してください。 ユーザーがボタンをクリックしたときにpdfの異なるページをナビゲートするのにも苦労しています...

関連する問題