UITableView crash in iOS 8 on heightForHeaderInSection - ios

UITableView in view controller. While reload the tableView two times and click cell it crash with different errors. I declare in .h interface.
{
UITableView *tblRestaurantList;
}
// also change to #property (nonatomic, retain)UITableView *tblRestaurantList;
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0;
}
error reason : -[UITableViewCell tableView:heightForHeaderInSection:]
error reason : [_UIAppearanceCustomizableClassInfo tableView:heightForHeaderInSection:]
Sometime it shows EXC_BAD_ACCESS(code=EXC_i386_GPFLT) or __NSCFArray or [_CTNativeGlyphStorage tableView:heightForHeaderInSection:].(With 40 line error message)
I change the height to 1.0f, 0.0,0.0001f,1;
I don't what happen its run successfully in iOS 7. I saw many questions in StackOverflow but no one post exact answer.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_CTNativeGlyphStorage tableView:heightForHeaderInSection:]: unrecognized selector sent to instance 0x7fcdf0f1e6a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000011376bf35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000112589bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000011377304d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001136cb27c ___forwarding___ + 988
4 CoreFoundation 0x00000001136cae18 _CF_forwarding_prep_0 + 120
5 UIKit 0x0000000110ce1f4e -[UITableView _delegateWantsHeaderForSection:] + 261
6 UIKit 0x0000000110e66983 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 162
7 UIKit 0x0000000110e6ce45 -[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 320
8 UIKit 0x0000000110e6cf3a -[UITableViewRowData heightForTable] + 56
9 UIKit 0x0000000110cbfaf0 -[UITableView _updateContentSize] + 381
10 UIKit 0x0000000110cdcecd -[UITableView didMoveToWindow] + 65
11 UIKit 0x0000000110c639a0 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1482
12 UIKit 0x0000000110c74333 -[UIScrollView _didMoveFromWindow:toWindow:] + 55
13 UIKit 0x0000000110c6368e -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
14 UIKit 0x0000000110c6368e -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
15 UIKit 0x0000000110c6368e -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
16 UIKit 0x0000000110c5c112 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
17 UIKit 0x0000000110c5c086 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
18 UIKit 0x0000000110c65f4b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1604
19 UIKit 0x0000000110be4bf1 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 2030
20 UIKit 0x0000000110c605ce +[UIView(Animation) performWithoutAnimation:] + 65
21 UIKit 0x0000000110be4072 -[_UINavigationParallaxTransition animateTransition:] + 1225
22 UIKit 0x0000000110d38e6c -[UINavigationController _startCustomTransition:] + 3038
23 UIKit 0x0000000110d443fe -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
24 UIKit 0x0000000110d44f47 -[UINavigationController __viewWillLayoutSubviews] + 43
25 UIKit 0x0000000110e8a509 -[UILayoutContainerView layoutSubviews] + 202
26 UIKit 0x0000000110c68973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
27 QuartzCore 0x0000000110347de8 -[CALayer layoutSublayers] + 150
28 QuartzCore 0x000000011033ca0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
29 QuartzCore 0x000000011033c87e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
30 QuartzCore 0x00000001102aa63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
31 QuartzCore 0x00000001102ab74a _ZN2CA11Transaction6commitEv + 390
32 QuartzCore 0x00000001102abdb5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
33 CoreFoundation 0x00000001136a0dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
34 CoreFoundation 0x00000001136a0d20 __CFRunLoopDoObservers + 368
35 CoreFoundation 0x0000000113696b53 __CFRunLoopRun + 1123
36 CoreFoundation 0x0000000113696486 CFRunLoopRunSpecific + 470
37 GraphicsServices 0x00000001144d09f0 GSEventRunModal + 161
38 UIKit 0x0000000110bef420 UIApplicationMain + 1282
39 Restaurant 0x000000010f466193 main + 115
40 libdyld.dylib 0x0000000112c10145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am using OS X Yosemite ver 10.10, xcode Version 6.1 (6A1052d), iPhone simulator iOS 8.1 (12B411).
Thanks in Advance

But why you put 0 in height ??
we can't put 0 here . if you do not want to put height for section, then don't put 0 in height.
This should be some value
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 4; // something like this
}

Related

Why calling selector of the subclass raise error, while the parent(s) certainly have it?

I'm using JSQMessageViewController for chat UI. The JSQMessageViewController implements UIScrollViewDelegate, and having scrollViewDidScroll: function.
And then I subclass JSQMessageViewController into MessagesVc. The scrollViewDidScroll: is called correctly without I even need to override it in the MessagesVc.
And then I create another subclass of JSQMessageViewController as JSQBaseViewController. I override the scrollViewDidScroll: here, and also calling super.scrollViewDidScroll: inside it. My MessagesVc now is a subclass of JSQBaseViewController instead of JSQMessageViewController.
But when I ran the app, now it raise the error: reason: '-[MyApps.MessagesVc scrollViewDidScroll:]: unrecognized selector sent to instance 0x7fe5ed00aa00'. Why is this happened? I don't think this error is supposed to happen, right?
EDIT: I tried to override scrollViewDidScroll: in MessagesVc and it still doesn't work.
Here is the circumstances of the implementation of scrollViewDidScroll: override:
import JSQMessageViewController
class JSQBaseViewController : JSQMessageViewController {
...
}
extension JSQBaseViewController {
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
super.scrollViewDidScroll(scrollView)
...
}
}
class MessagesVc : JSQBaseViewController {
...
// still no override implementation of scrollViewDidScroll here
}
Call stack:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyApps.MessagesVc scrollViewDidScroll:]: unrecognized selector sent to instance 0x7fe5ed00aa00'
*** First throw call stack:
(
0 CoreFoundation 0x00000001084f01e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000107b85031 objc_exception_throw + 48
2 CoreFoundation 0x0000000108571784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x00000001098df73b -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x00000001084725f8 ___forwarding___ + 760
5 CoreFoundation 0x0000000108472278 _CF_forwarding_prep_0 + 120
6 MyApps 0x0000000105362eb3 _T06MyApps21JSQBaseViewControllerC06scrollC9DidScrollySo08UIScrollC0CF + 131
7 MyApps 0x0000000105363e2c _T06MyApps21JSQBaseViewControllerC06scrollC9DidScrollySo08UIScrollC0CFTo + 60
8 UIKit 0x00000001097a8bcf -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 66
9 UIKit 0x000000010978eb87 -[UIScrollView setContentOffset:] + 468
10 UIKit 0x00000001097ac854 -[UIScrollView(UIScrollViewInternal) _setContentOffset:animated:animationCurve:animationAdjustsForContentOffsetDelta:animation:] + 1022
11 UIKit 0x000000010a187f35 -[UICollectionView setContentOffset:animated:] + 350
12 JSQMessagesViewController 0x0000000106f842e5 -[JSQMessagesViewController scrollToIndexPath:animated:] + 2165
13 JSQMessagesViewController 0x0000000106f83a59 -[JSQMessagesViewController scrollToBottomAnimated:] + 265
14 JSQMessagesViewController 0x0000000106f83714 -[JSQMessagesViewController finishSendingMessageAnimated:] + 660
15 JSQMessagesViewController 0x0000000106f83470 -[JSQMessagesViewController finishSendingMessage] + 48
16 MyApps 0x000000010584350b _T06MyApps10MessagesVcC13reloadDisplayyyF + 27
17 MyApps 0x0000000105843544 _T06MyApps10MessagesVcC13reloadDisplayyyFTo + 36
18 MyApps 0x000000010561f713 _T06MyApps10MessagesVcC10dataSourceSayAA9MyMessageCGSgvW + 35
19 MyApps 0x000000010561f6c9 _T06MyApps10MessagesVcC10dataSourceSayAA9MyMessageCGSgvs + 233
20 MyApps 0x0000000105842fad _T06MyApps10MessagesVcC10reloadDatayyF + 717
21 MyApps 0x00000001058434d4 _T06MyApps10MessagesVcC10reloadDatayyFTo + 36
22 MyApps 0x00000001055d4744 _T06MyApps10MessagesVcC11viewDidLoadyyF + 2148
23 MyApps 0x00000001055d5a94 _T06MyApps10MessagesVcC11viewDidLoadyyFTo + 36
24 UIKit 0x0000000109855191 -[UIViewController loadViewIfRequired] + 1215
25 UIKit 0x00000001098555d4 -[UIViewController view] + 27
26 UIKit 0x0000000109886c6e -[UINavigationController _startCustomTransition:] + 945
27 UIKit 0x000000010989d5e2 -[UINavigationController _startDeferredTransitionIfNeeded:] + 714
28 UIKit 0x000000010989e8cc -[UINavigationController __viewWillLayoutSubviews] + 150
29 UIKit 0x0000000109af6bd7 -[UILayoutContainerView layoutSubviews] + 231
30 UIKit 0x0000000109780808 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
31 QuartzCore 0x000000010931061a -[CALayer layoutSublayers] + 177
32 QuartzCore 0x000000010931482b _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
33 QuartzCore 0x000000010929b29f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
34 QuartzCore 0x00000001092c8940 _ZN2CA11Transaction6commitEv + 568
35 UIKit 0x00000001096d9f8c _afterCACommitHandler + 272
36 CoreFoundation 0x0000000108492607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
37 CoreFoundation 0x000000010849255e __CFRunLoopDoObservers + 430
38 CoreFoundation 0x0000000108476b81 __CFRunLoopRun + 1537
39 CoreFoundation 0x000000010847630b CFRunLoopRunSpecific + 635
40 GraphicsServices 0x00000001104bea73 GSEventRunModal + 62
41 UIKit 0x00000001096b10b7 UIApplicationMain + 159
42 MyApps 0x0000000105755ac7 main + 55
43 libdyld.dylib 0x000000010cf0e955 start + 1
44 ??? 0x0000000000000001 0x0 + 1
)

iOS uncaught exception adding subview crash

In my iOS app, I am using both Swift and Obj-c with an external library but for some reason I am getting a crash when the library adds a subview.
[view addSubview:self];
The stacktrace is as follows, which is quite hard to track the error as its not near the top(i think).
*** Terminating app due to uncaught exception 'NSRangeException', reason:
'*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010913ac65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108dd3bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000109024093 -[__NSArrayM objectAtIndex:] + 227
3 UIKit 0x0000000106fa1881 _UIViewTopDownSubtreeTraversal + 193
4 UIKit 0x00000001075c2fa3 -[UIView(UIConstraintBasedLayout_EngineDelegate) _invalidateSystemLayoutSizeFittingSizeAtEngineDelegateLevel] + 141
5 Foundation 0x00000001065e4d6f -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 915
6 Foundation 0x000000010676f1e8 -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 275
7 Foundation 0x00000001065d949a -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 220
8 UIKit 0x00000001075bfa34 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 474
9 Foundation 0x00000001065e71be -[NSISEngine withBehaviors:performModifications:] + 155
10 UIKit 0x00000001075bf83a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 452
11 UIKit 0x00000001075bf64d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 197
12 UIKit 0x00000001075bf933 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 217
13 Foundation 0x00000001065e71be -[NSISEngine withBehaviors:performModifications:] + 155
14 UIKit 0x00000001075bf83a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 452
15 UIKit 0x00000001075bf64d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 197
16 UIKit 0x00000001075bf2de -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 404
17 UIKit 0x00000001075b426e -[UIView(UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 126
18 UIKit 0x0000000106fbf561 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 209
19 UIKit 0x0000000106fb7ecf __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
20 UIKit 0x0000000106fb7e43 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
21 UIKit 0x0000000106fc1f48 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1660
22 UIKit 0x0000000106f3765a -[_UIParallaxDimmingView didMoveToWindow] + 123
23 UIKit 0x0000000106fbfa68 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1496
24 UIKit 0x0000000106fbf74a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
25 UIKit 0x0000000106fb7ecf __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
26 UIKit 0x0000000106fb7e43 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
27 UIKit 0x0000000106fc1f48 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1660
28 UIKit 0x0000000106f33f08 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 2101
29 UIKit 0x0000000106fbc68e +[UIView(Animation) performWithoutAnimation:] + 65
30 UIKit 0x0000000106f33342 -[_UINavigationParallaxTransition animateTransition:] + 1225
31 UIKit 0x000000010709abfc -[UINavigationController _startCustomTransition:] + 3038
32 UIKit 0x00000001070a63bf -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
33 UIKit 0x00000001070a6f0e -[UINavigationController __viewWillLayoutSubviews] + 43
34 UIKit 0x00000001071f1715 -[UILayoutContainerView layoutSubviews] + 202
35 UIKit 0x0000000106fc4a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
36 QuartzCore 0x00000001087e3ec2 -[CALayer layoutSublayers] + 146
37 QuartzCore 0x00000001087d86d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
38 QuartzCore 0x00000001087d8546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
39 QuartzCore 0x0000000108744886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
40 QuartzCore 0x0000000108745a3a _ZN2CA11Transaction6commitEv + 462
41 QuartzCore 0x00000001087460eb _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
42 CoreFoundation 0x000000010906dca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
43 CoreFoundation 0x000000010906dc00 __CFRunLoopDoObservers + 368
44 CoreFoundation 0x0000000109063a33 __CFRunLoopRun + 1123
45 CoreFoundation 0x0000000109063366 CFRunLoopRunSpecific + 470
46 GraphicsServices 0x000000010b1bfa3e GSEventRunModal + 161
47 UIKit 0x0000000106f44900 UIApplicationMain + 1282
48 HedgeEm 0x0000000104f1cfdf main + 111
49 libdyld.dylib 0x0000000109cff145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
My first thoughts were to look for anything that was using an array, but in my code there wasnt anything, I think its related to iOS adding the subview but failing.
Further investigation, the same implementation works in ios 7, I know its related to a possible constraint issue - maybe the compile time constraints that get added. I guess this serves me right for using an old library.
I was using the EAIntroView library EAIntroView - GitHub
It turns out that there is a problem with the library and the latest version causes a crash in iOS 8, GitHub - crash discussion So the solution is to downgrade to 2.6 and it works fine.

Unable to understand the Crash Logs

I have a view,which consists a UIScrollView on which subviews would added in viewDidLoad after adding all subviews & after the execution of all custom methods it goes to viewWillappear,after that it crashes with the following traces:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString CIImage]: unrecognized selector sent to instance 0x7db5bb80'
*** First throw call stack:
(
0 CoreFoundation 0x04614946 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x0429da97 objc_exception_throw + 44
2 CoreFoundation 0x0461c5c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277
3 CoreFoundation 0x045653e7 ___forwarding___ + 1047
4 CoreFoundation 0x04564fae _CF_forwarding_prep_0 + 14
5 UIKit 0x02b589f1 -[UIImageView _shouldDrawImage:] + 33
6 UIKit 0x02b58aa2 -[UIImageView _canDrawContent] + 164
7 UIKit 0x02a2f750 -[UIView(Internal) _shouldInheritScreenScaleAsContentScaleFactor] + 83
8 UIKit 0x02a2f7e9 -[UIView(Internal) _applyScreenScaleToContentScaleFactorIfNotSpecifiedByDeveloper] + 35
9 UIKit 0x02a2f56e -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1628
10 UIKit 0x02b5d762 -[UIImageView _didMoveFromWindow:toWindow:] + 65
11 UIKit 0x02a2f23f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
12 UIKit 0x02a423e1 -[UIScrollView _didMoveFromWindow:toWindow:] + 65
13 UIKit 0x02a2f23f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
14 UIKit 0x02a2f23f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
15 UIKit 0x02a26517 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
16 UIKit 0x02a26475 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
17 UIKit 0x02a31f0d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2018
18 UIKit 0x02a2486e -[UIView(Hierarchy) addSubview:] + 56
19 UIKit 0x0299d0fa __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1849
20 UIKit 0x02a2b7af +[UIView(Animation) performWithoutAnimation:] + 82
21 UIKit 0x0299c5a6 -[_UINavigationParallaxTransition animateTransition:] + 1204
22 UIKit 0x02b2b64d -[UINavigationController _startCustomTransition:] + 3765
23 UIKit 0x02b38726 -[UINavigationController _startDeferredTransitionIfNeeded:] + 712
24 UIKit 0x02b39372 -[UINavigationController __viewWillLayoutSubviews] + 57
25 UIKit 0x02cad04c -[UILayoutContainerView layoutSubviews] + 213
26 UIKit 0x02a34dd1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
27 libobjc.A.dylib 0x042b3771 -[NSObject performSelector:withObject:] + 70
28 QuartzCore 0x0215928f -[CALayer layoutSublayers] + 152
29 QuartzCore 0x0214d115 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 397
30 QuartzCore 0x0214cf70 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
31 QuartzCore 0x020ab3c6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
32 QuartzCore 0x020ac78c _ZN2CA11Transaction6commitEv + 392
33 QuartzCore 0x020ace58 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
34 CoreFoundation 0x045379de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
35 CoreFoundation 0x04537920 __CFRunLoopDoObservers + 400
36 CoreFoundation 0x0452d35a __CFRunLoopRun + 1226
37 CoreFoundation 0x0452cbcb CFRunLoopRunSpecific + 443
38 CoreFoundation 0x0452c9fb CFRunLoopRunInMode + 123
39 GraphicsServices 0x05e6b24f GSEventRunModal + 192
40 GraphicsServices 0x05e6b08c GSEventRun + 104
41 UIKit 0x029a98b6 UIApplicationMain + 1526
42 POPCorn 0x000e9472 main + 130
43 libdyld.dylib 0x06193ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString CIImage]: unrecognized selector sent to instance 0x7db5bb80'
You're accessing the CIImage property of an NSString (perhaps its id and you just accessed this property thinking that the id object was a UIImage). Search for CIImage in your class and make sure the object you're getting the property from is an actual UIImage.
If you want to find out where the actual line of code that is causing i suggest creating an exception breakpoint. You can do this by going to the breakpoints tab and adding one for all exceptions. This along with the log you should see what you are passing an invalid argument to.

AdBannerView Causing NSInvalidArguementException

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?

ios 7.1 Crash when tap on More button on tab bar

I got an crash bug on when tap on More button on tabbar. It just happened on iOS 7.1.
I created a class (MoreTableViewDelegate) which override UITableViewDelegate of More Table View
MoreNavigationController
UIViewController *moreViewController = tabBarController.moreNavigationController.topViewController;
UITableView *moreTableView = (UITableView*)moreViewController.view;
MoreTableViewDelegate *objMoreDelegate=[[MoreTableViewDelegate alloc]initWithDelegate:moreTableView.delegate];
moreTableView.delegate=objMoreDelegate;
This is the detail of MoreTableViewDelegate:
-(MoreTableViewDelegate *) initWithDelegate:(id<UITableViewDelegate>) delegate
{
originalDelegate=delegate;
[super init];
return self;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(isPoweredByMobicart==YES)
{
return 50;
}
else
{
return 60;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
return [originalDelegate tableView:tableView didSelectRowAtIndexPath:indexPath];
}
But when I tap on the More button at tab bar, it's crashed and this is the log:
-[MoreTableViewDelegate _layoutCells]: unrecognized selector sent to instance 0xce7f300
2014-03-25 11:03:12.360 ForeverInt[961:90b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MoreTableViewDelegate _layoutCells]: unrecognized selector sent to instance 0xce7f300'
*** First throw call stack:
(
0 CoreFoundation 0x0336b1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02ee18e5 objc_exception_throw + 44
2 CoreFoundation 0x03408243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0335b50b ___forwarding___ + 1019
4 CoreFoundation 0x0335b0ee _CF_forwarding_prep_0 + 14
5 UIKit 0x00bcc785 -[_UIMoreListTableView didMoveToWindow] + 108
6 UIKit 0x00adb478 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1642
7 UIKit 0x00aed68b -[UIScrollView _didMoveFromWindow:toWindow:] + 65
8 UIKit 0x00adb109 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 763
9 UIKit 0x00ad296f __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 158
10 UIKit 0x00ad27fb -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
11 UIKit 0x00adddd4 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1875
12 UIKit 0x00ad0dba -[UIView(Hierarchy) addSubview:] + 56
13 UIKit 0x00db6c5b -[UINavigationTransitionView transition:fromView:toView:] + 501
14 UIKit 0x00db6a5e -[UINavigationTransitionView transition:toView:] + 55
15 UIKit 0x00bb7577 -[UINavigationController _startTransition:fromViewController:toViewController:] + 3186
16 UIKit 0x00bb78cc -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
17 UIKit 0x00bb84e9 -[UINavigationController __viewWillLayoutSubviews] + 57
18 UIKit 0x00cf90d1 -[UILayoutContainerView layoutSubviews] + 213
19 UIKit 0x00ae0964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
20 libobjc.A.dylib 0x02ef382b -[NSObject performSelector:withObject:] + 70
21 QuartzCore 0x01d9d45a -[CALayer layoutSublayers] + 148
22 QuartzCore 0x01d91244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
23 QuartzCore 0x01d910b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
24 QuartzCore 0x01cf77fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
25 QuartzCore 0x01cf8b85 _ZN2CA11Transaction6commitEv + 393
26 QuartzCore 0x01db65b0 +[CATransaction flush] + 52
27 UIKit 0x00a6f9bb _UIApplicationHandleEventQueue + 13095
28 CoreFoundation 0x032f477f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
29 CoreFoundation 0x032f410b __CFRunLoopDoSources0 + 235
30 CoreFoundation 0x033111ae __CFRunLoopRun + 910
31 CoreFoundation 0x033109d3 CFRunLoopRunSpecific + 467
32 CoreFoundation 0x033107eb CFRunLoopRunInMode + 123
33 GraphicsServices 0x035c85ee GSEventRunModal + 192
34 GraphicsServices 0x035c842b GSEventRun + 104
35 UIKit 0x00a71f9b UIApplicationMain + 1225
36 ForeverInt 0x00086b9d main + 125
37 ForeverInt 0x000030d5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException
How to solve this issue ? Please help me.

Resources