0

I'm creating an Ad enabled application, and to the most part its been successful to how I wanted it, however recently my application started crashing with an NSInvalidArgumentException error whenever I start the application, after some serious debugging I've found that the cause of the error is when my ADBannerView delegate is linked to my UITableViewController class. I've implemented the ADBannerViewDelegate to my class so I can't understand what the issue with it is. I'm trying to keep my code as private as possible to avoid my idea to be recreated. So for now I'll be posting the crash log. If any other information is needed I'll post the bare minimum of what has been asked for

2014-07-09 16:48:32.268 <APPLICATION NAME>[3491:589625] *** 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                      0x00ee5646 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x00b878e3 objc_exception_throw + 44
    2   CoreFoundation                      0x00ddc513 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 451
    3   CoreFoundation                      0x00df16bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 75
    4   iAd                                 0x00688cf5 -[ADBannerView setDelegate:] + 161
    5   Foundation                          0x0077ace8 _NSSetUsingKeyValueSetter + 115
    6   Foundation                          0x0077ac6d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    7   UIKit                               0x0131b034 -[UIView(CALayerDelegate) setValue:forKey:] + 168
    8   Foundation                          0x007b0166 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 386
    9   UIKit                               0x015b3589 -[UIRuntimeOutletConnection connect] + 106
    10  libobjc.A.dylib                     0x00b9a6f4 -[NSObject performSelector:] + 62
    11  CoreFoundation                      0x00e2041c -[NSArray makeObjectsPerformSelector:] + 316
    12  UIKit                               0x015b1b8a -[UINib instantiateWithOwner:options:] + 1775
    13  UIKit                               0x013e074d -[UIViewController _loadViewFromNibNamed:bundle:] + 270
    14  UIKit                               0x013e0ff4 -[UIViewController loadView] + 295
    15  UIKit                               0x015d2266 -[UITableViewController loadView] + 77
    16  UIKit                               0x013e1222 -[UIViewController loadViewIfRequired] + 72
    17  UIKit                               0x014142bd -[UINavigationController _layoutViewController:] + 42
    18  UIKit                               0x014147bf -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    19  UIKit                               0x014148c3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 90
    20  UIKit                               0x0141583a -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
    21  UIKit                               0x0141645b -[UINavigationController __viewWillLayoutSubviews] + 57
    22  UIKit                               0x01580c40 -[UILayoutContainerView layoutSubviews] + 213
    23  UIKit                               0x0131b3dc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 601
    24  libobjc.A.dylib                     0x00b9a741 -[NSObject performSelector:withObject:] + 70
    25  QuartzCore                          0x005703e9 -[CALayer layoutSublayers] + 152
    26  QuartzCore                          0x00564245 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
    27  QuartzCore                          0x005640a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    28  QuartzCore                          0x004c3836 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
    29  QuartzCore                          0x004c4bfc _ZN2CA11Transaction6commitEv + 392
    30  QuartzCore                          0x00589689 +[CATransaction flush] + 52
    31  UIKit                               0x0129012e -[UIApplication _reportMainSceneUpdateFinished:] + 39
    32  UIKit                               0x01291023 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3027
    33  UIKit                               0x012a8eb8 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    34  UIKit                               0x0128f77e -[UIApplication workspaceDidEndTransaction:] + 29
    35  FrontBoardServices                  0x06e43f1f -[FBSWorkspace clientEndTransaction:] + 87
    36  FrontBoardServices                  0x06e4b4ed __53-[FBSWorkspaceClient _queue_handleTransactionBookEnd]_block_invoke + 49
    37  CoreFoundation                      0x00e09f90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    38  CoreFoundation                      0x00dff133 __CFRunLoopDoBlocks + 195
    39  CoreFoundation                      0x00dfe898 __CFRunLoopRun + 936
    40  CoreFoundation                      0x00dfe22b CFRunLoopRunSpecific + 443
    41  CoreFoundation                      0x00dfe05b CFRunLoopRunInMode + 123
    42  UIKit                               0x0128f095 -[UIApplication _run] + 571
    43  UIKit                               0x012926e5 UIApplicationMain + 1526
    44  AppIdeas                            0x0001a4ed main + 141
    45  libdyld.dylib                       0x02ca1ac9 start + 1
    46  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

Also, I'd like to point out that I'm not using an NSPlaceholderDictionary at all in my program, nor am I using the method initWithObjects:forKeys:count:

Hopefully you guys should be able to help with this, thanks for you help

EDIT: I'd Also like to point out that All my other Pages (Part of a UITabBarController) load the ads fine, with the delegate added like the first page, it only happens on the application launch for the first view to come into focus... Is there something I'm missing?

Zach Ross-Clyne
  • 779
  • 3
  • 10
  • 35
  • Something is nil when it shouldn't. Without code, it's difficult to get where. Try to figure out which line exactly and what parameter. – Larme Jul 09 '14 at 16:00
  • I'm happy to give some code, I just don't really know what parts to give. Or If you could answer in Private message even better. I'm happy to give more code to just one person than to display publicly here – Zach Ross-Clyne Jul 09 '14 at 16:04
  • Having done several breakpoints, I know that the error is happening between AppDelegate didFinishLaunching and Root TableViewController viewDidLoad, if that helps at all? – Zach Ross-Clyne Jul 09 '14 at 16:08
  • Try to find the exact line, and check all values in that line. – Larme Jul 09 '14 at 16:12
  • As I said, its not done programmatically, and when I do it programmatically the line that it breaks on is the setDelegate line. I think this may be an Apple issue to do with TableViews and ADBannerViews – Zach Ross-Clyne Jul 09 '14 at 16:16
  • Is it required to set the ADBannerView's delegate? – Zach Ross-Clyne Jul 09 '14 at 16:42

0 Answers0