Ios FastPDFkit自定义类问题

Ios FastPDFkit自定义类问题,ios,objective-c,fastpdfkit,Ios,Objective C,Fastpdfkit,我正在使用第三方iOS库FastPDFkit呈现PDF,并在其上执行一些自定义操作,如保存、收藏、电子邮件等。 很久以来,我一直在使用它的32位版本 现在,我想把它升级到64位。我尝试集成新的FastPDFkit框架。我用图书馆推荐的控制器做了一个小PoC。它的工作原理如下: -(IBAction)actionOpenPlainDocument:(id)sender{ /** Set document name */ NSString *documentName = @"M

我正在使用第三方iOS库FastPDFkit呈现PDF,并在其上执行一些自定义操作,如保存、收藏、电子邮件等。 很久以来,我一直在使用它的32位版本

现在,我想把它升级到64位。我尝试集成新的FastPDFkit框架。我用图书馆推荐的控制器做了一个小PoC。它的工作原理如下:

   -(IBAction)actionOpenPlainDocument:(id)sender{
    /** Set document name */
    NSString *documentName = @"Manual"; // Manual indicates catalog name

    /** Get temporary directory to save thumbnails */
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

    /** Set thumbnails path */
    NSString *thumbnailsPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",documentName]];

    /** Get document from the App Bundle */
    NSURL *documentUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:documentName ofType:@"pdf"]];

    /** Instancing the documentManager */
    MFDocumentManager *documentManager = [[MFDocumentManager alloc]initWithFileUrl:documentUrl];

    /** Instancing the readerViewController */
    ReaderViewController *pdfViewController = [[ReaderViewController alloc]initWithDocumentManager:documentManager];

    /** Set resources folder on the manager */
    documentManager.resourceFolder = thumbnailsPath;

    /** Set document id for thumbnail generation */
    pdfViewController.documentId = documentName;

    /** Present the pdf on screen in a modal view */
    [self presentViewController:pdfViewController animated:YES completion:nil];

    /** Release the pdf controller*/
   // [pdfViewController release];
}
此代码适用于默认组件。 这里,
ReaderViewController
是FastPDFkit建议打开PDF的控制器

在FastPDFkit头文件中,我检查了
ReaderViewController
是否来自
MFDocumentViewController
。 像这样:

@interface ReaderViewController : MFDocumentViewController <MFDocumentViewControllerDelegate
在实施方面:

iPhonePDFViewController *viewController =  [[iPhonePDFViewController alloc] initWithDocumentManager:documentManager];

            viewController.documentName = @"Manual";//I took this PDF from some other way.

            documentManager.resourceFolder = thumbnailsPath;
            viewController.documentId = documentName;

            [self.navigationController pushViewController:viewController animated:YES];
但它却在说:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x030b9746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x04428a97 objc_exception_throw + 44
    2   CoreFoundation                      0x02fafc93 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 451
    3   CoreFoundation                      0x02fc3b7b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 75
    4   CatalogApp                    0x00249e4b priorityForOffset + 41190
    5   CatalogApp                    0x00247f34 priorityForOffset + 33231
    6   CatalogApp                    0x000d93e8 -[iPhonePDFViewController viewDidLoad] + 72
    7   UIKit                               0x00eeada4 -[UIViewController loadViewIfRequired] + 771
    8   UIKit                               0x00f227bd -[UINavigationController _layoutViewController:] + 42
    9   UIKit                               0x00f22d2c -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    10  UIKit                               0x00f22e30 -[UINavigationController _startTransition:fromViewController:toViewController:] + 90
    11  UIKit                               0x00f23dd5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
    12  UIKit                               0x00f24a51 -[UINavigationController __viewWillLayoutSubviews] + 57
    13  UIKit                               0x0109e750 -[UILayoutContainerView layoutSubviews] + 213
    14  UIKit                               0x00e1957a -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 668
    15  libobjc.A.dylib                     0x0443e771 -[NSObject performSelector:withObject:] + 70
    16  QuartzCore                          0x021bfe47 -[CALayer layoutSublayers] + 144
    17  QuartzCore                          0x021b3925 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 403
    18  QuartzCore                          0x021b377a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    19  QuartzCore                          0x0210fc52 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    20  QuartzCore                          0x021110e5 _ZN2CA11Transaction6commitEv + 487
    21  QuartzCore                          0x021117fc _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    22  CoreFoundation                      0x02fda86e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    23  CoreFoundation                      0x02fda7b0 __CFRunLoopDoObservers + 400
    24  CoreFoundation                      0x02fd01ea __CFRunLoopRun + 1226
    25  CoreFoundation                      0x02fcfa5b CFRunLoopRunSpecific + 443
    26  CoreFoundation                      0x02fcf88b CFRunLoopRunInMode + 123
    27  GraphicsServices                    0x055262c9 GSEventRunModal + 192
    28  GraphicsServices                    0x05526106 GSEventRun + 104
    29  UIKit                               0x00d86106 UIApplicationMain + 1526
    30  CatalogApp                    0x0007e36a main + 138
    31  libdyld.dylib                       0x05b61ac9 start + 1
    32  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

当您试图插入的对象可能是
NSArray
NSDictionary
并且该对象不再存在(为零)时,会出现此错误。那么这个错误可能会被触发。首先尝试启用Zombie并检查其崩溃的确切位置?您可能在您的
iPhonePDFViewController
类中出错。在不同的视图方法中保留断点,并检查其崩溃的确切位置?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x030b9746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x04428a97 objc_exception_throw + 44
    2   CoreFoundation                      0x02fafc93 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 451
    3   CoreFoundation                      0x02fc3b7b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 75
    4   CatalogApp                    0x00249e4b priorityForOffset + 41190
    5   CatalogApp                    0x00247f34 priorityForOffset + 33231
    6   CatalogApp                    0x000d93e8 -[iPhonePDFViewController viewDidLoad] + 72
    7   UIKit                               0x00eeada4 -[UIViewController loadViewIfRequired] + 771
    8   UIKit                               0x00f227bd -[UINavigationController _layoutViewController:] + 42
    9   UIKit                               0x00f22d2c -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    10  UIKit                               0x00f22e30 -[UINavigationController _startTransition:fromViewController:toViewController:] + 90
    11  UIKit                               0x00f23dd5 -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
    12  UIKit                               0x00f24a51 -[UINavigationController __viewWillLayoutSubviews] + 57
    13  UIKit                               0x0109e750 -[UILayoutContainerView layoutSubviews] + 213
    14  UIKit                               0x00e1957a -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 668
    15  libobjc.A.dylib                     0x0443e771 -[NSObject performSelector:withObject:] + 70
    16  QuartzCore                          0x021bfe47 -[CALayer layoutSublayers] + 144
    17  QuartzCore                          0x021b3925 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 403
    18  QuartzCore                          0x021b377a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    19  QuartzCore                          0x0210fc52 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    20  QuartzCore                          0x021110e5 _ZN2CA11Transaction6commitEv + 487
    21  QuartzCore                          0x021117fc _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    22  CoreFoundation                      0x02fda86e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    23  CoreFoundation                      0x02fda7b0 __CFRunLoopDoObservers + 400
    24  CoreFoundation                      0x02fd01ea __CFRunLoopRun + 1226
    25  CoreFoundation                      0x02fcfa5b CFRunLoopRunSpecific + 443
    26  CoreFoundation                      0x02fcf88b CFRunLoopRunInMode + 123
    27  GraphicsServices                    0x055262c9 GSEventRunModal + 192
    28  GraphicsServices                    0x05526106 GSEventRun + 104
    29  UIKit                               0x00d86106 UIApplicationMain + 1526
    30  CatalogApp                    0x0007e36a main + 138
    31  libdyld.dylib                       0x05b61ac9 start + 1
    32  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException