[_NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0..1] - ios

I'm using a simulator for iphone 4s(iOS 7.0.3) for my app and I get the following error
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 1]'
*** First throw call stack:
(
0 CoreFoundation 0x003085e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x027568b6 objc_exception_throw + 44
2 CoreFoundation 0x002a94e6 -[__NSArrayM objectAtIndex:] + 246
3 Requisitions 0x0015007a -[PasswordLoginController3 _adjustInputPos] + 61
4 Requisitions 0x0015042a -[PasswordLoginController3 keyboardWasShown:] + 312
5 Foundation 0x02428bf9 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40
6 CoreFoundation 0x00364524 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
7 CoreFoundation 0x002bc00b _CFXNotificationPost + 2859
8 Foundation 0x02362951 -[NSNotificationCenter postNotificationName:object:userInfo:] + 98
9 UIKit 0x009ffb1b -[UIInputViewTransition postNotificationsForTransitionEnd] + 1054
10 UIKit 0x009f6138 __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1332 + 455
11 UIKit 0x006993c0 -[UINavigationControllerKeyboardAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:] + 501
12 UIKit 0x009f5a7c -[UIPeripheralHost(UIKitInternal) executeTransition:] + 1258
13 UIKit 0x009f7c0e -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1029
14 UIKit 0x009f8019 -[UIPeripheralHost(UIKitInternal) setInputViews:animated:] + 72
15 UIKit 0x009f8063 -[UIPeripheralHost(UIKitInternal) setInputViews:] + 67
16 UIKit 0x009ef2fa -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1453
17 UIKit 0x006c969a -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 287
18 UIKit 0x006c8f8b -[UIResponder becomeFirstResponder] + 550
19 UIKit 0x005cc19b -[UIView(Hierarchy) becomeFirstResponder] + 114
20 UIKit 0x00c4ce43 -[UITextField becomeFirstResponder] + 51
21 UIKit 0x005cc1e8 -[UIView(Hierarchy) deferredBecomeFirstResponder] + 67
22 UIKit 0x005cc27c -[UIView(Hierarchy) _promoteSelfOrDescendantToFirstResponderIfNecessary] + 115
23 UIKit 0x005cc53e __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 224
24 UIKit 0x005cc388 -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
25 UIKit 0x005d74c1 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847
26 UIKit 0x005ca9b1 -[UIView(Hierarchy) addSubview:] + 56
27 UIKit 0x00563848 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1927
28 UIKit 0x005d13ef +[UIView(Animation) performWithoutAnimation:] + 82
29 UIKit 0x00562c96 -[_UINavigationParallaxTransition animateTransition:] + 1155
30 UIKit 0x0069de4e -[UINavigationController _startCustomTransition:] + 3446
31 UIKit 0x006aa0c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
32 UIKit 0x006aacb9 -[UINavigationController __viewWillLayoutSubviews] + 57
33 UIKit 0x007e4181 -[UILayoutContainerView layoutSubviews] + 213
34 UIKit 0x005da267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
35 libobjc.A.dylib 0x0276881f -[NSObject performSelector:withObject:] + 70
36 QuartzCore 0x022182ea -[CALayer layoutSublayers] + 148
37 QuartzCore 0x0220c0d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
38 QuartzCore 0x0220bf40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
39 QuartzCore 0x02173ae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
40 QuartzCore 0x02174e71 _ZN2CA11Transaction6commitEv + 393
41 QuartzCore 0x02175544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
42 CoreFoundation 0x002d04ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
43 CoreFoundation 0x002d041f __CFRunLoopDoObservers + 399
44 CoreFoundation 0x002ae344 __CFRunLoopRun + 1076
45 CoreFoundation 0x002adac3 CFRunLoopRunSpecific + 467
46 CoreFoundation 0x002ad8db CFRunLoopRunInMode + 123
47 GraphicsServices 0x03ce39e2 GSEventRunModal + 192
48 GraphicsServices 0x03ce3809 GSEventRun + 104
49 UIKit 0x0056fd3b UIApplicationMain + 1225
50 Requisitions 0x000a712c main + 92
51 libdyld.dylib 0x03036701 start + 1
52 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I tried this thread CRASH: *** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 9] and tried to debug at certain breakpoint, but no avail. I couldn't figure out where the issue is happening. Objective C is not my forte , but still fixing this issue.
Method _adjustInputPos
-(void) _adjustInputPos
{
UITextField *currentField = [inputFields objectAtIndex:currentInputIndex];
CGFloat currentInputHeight = currentField.frame.origin.y;
UIView* v = [self.formView viewWithTag:70];
if(v!=nil) {
currentInputHeight += v.frame.origin.y;
}
UIScrollView* sv = (UIScrollView*)self.view;
CGFloat offset = 0;
if (sv.contentOffset.y>=(currentInputHeight)) {
offset = (sv.frame.size.height-kbHeight)/1.5;
} else if((self.view.frame.size.height-kbHeight-currentInputHeight)<currentField.frame.size.height) {
offset = (sv.frame.size.height-kbHeight)/1.5;
} else {
return;
}
if(sv.contentOffset.y==offset) {
return;
}
CGPoint scrollPoint = CGPointMake(0.0, offset);
[sv setContentOffset:scrollPoint animated:YES];
}
Method keyBoardWasShown
- (void) keyboardWasShown:(NSNotification*)notf
{
if(isHidden) {
return;
}
NSDictionary *info = [notf userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
kbHeight = kbSize.height;
BOOL islandscape = [[ClientAuthenticator getInstance].actionHandler isLandscape];
if(!islandscape && [LSUtility isTablet]) {//ipad portrait,no need.
return;
}
if(islandscape ) {
kbHeight = kbSize.width;
}
if (is30Style) {
[self _adjustInputPos];
} else {
[self _adjustInputPos31];
}
UIScrollView *sv = (UIScrollView*)self.view;
CGSize size = CGSizeMake(sv.frame.size.width, sv.frame.size.height+kbHeight/1.5);
[sv setContentSize:size];
}
Thanks

4294967295 is 0xFFFFFFFF in hex, or -1 as an unsigned int.
Check in [PasswordLoginController3 _adjustInputPos] - it is asking for objectAtIndex with the value -1 (which is out of bounds).
Edit since you added code
UITextField *currentField = [inputFields objectAtIndex:currentInputIndex]
This looks to be the line that the error comes from. What is the type of currentInputIndex and where is it initialised/modified?

Related

Store the data dynamically in uitableview using sqlite

Code:
NSString *Query=[NSString stringWithFormat:#"select *from peopleinfm where peopleinfmID=%d",TextEdit];
NSArray *Results=[[NSArray alloc]initWithArray:[DBManger loadDataFromDB:Query]];
self.FirstnameText.text=[[Results objectAtIndex:1]objectAtIndex:[self.DBManger.ColumnArray indexOfObject:#"firstname"]];
self.LastnameText.text=[[Results objectAtIndex:1]objectAtIndex:[self.DBManger.ColumnArray indexOfObject:#"lastname"]];
self.AgeText.text=[[Results objectAtIndex:1]objectAtIndex:[self.DBManger.ColumnArray indexOfObject:#"age"]];
Logs:
2016-02-12 19:03:36.068 SampleFMDB[9641:762577] no such table: peopleinfm
2016-02-12 19:03:36.077 SampleFMDB[9641:762577] _UIConstraintBasedLayoutLogUnsatisfiable is OFF
2016-02-12 19:03:37.934 SampleFMDB[9641:762577] no such table: peopleinfm
2016-02-12 19:03:37.978 SampleFMDB[9641:762577] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 1 beyond bounds for empty NSArray'
*** First throw call stack:
(
0 CoreFoundation 0x00b23a94 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x005e2e02 objc_exception_throw + 50
2 CoreFoundation 0x00aca4a0 __CFArrayGetTypeID_block_invoke + 0
3 SampleFMDB 0x00010003 -[AddViewController loadInfoToEdit] + 291
4 SampleFMDB 0x0000f9bc -[AddViewController viewDidLoad] + 396
5 UIKit 0x01070d74 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 44
6 UIKit 0x010758c2 -[UIViewController loadViewIfRequired] + 1556
7 UIKit 0x0107bf0e -[UIViewController __viewWillAppear:] + 114
8 UIKit 0x0109ecf0 -[UIViewController(UIContainerViewControllerProtectedMethods) beginAppearanceTransition:animated:] + 202
9 UIKit 0x010b0d63 -[UINavigationController _startCustomTransition:] + 1375
10 UIKit 0x010c1c0b -[UINavigationController _startDeferredTransitionIfNeeded:] + 801
11 UIKit 0x010c2d05 -[UINavigationController __viewWillLayoutSubviews] + 68
12 UIKit 0x0128cd9f -[UILayoutContainerView layoutSubviews] + 252
13 UIKit 0x00f7916b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 813
14 libobjc.A.dylib 0x005f7059 -[NSObject performSelector:withObject:] + 70
15 QuartzCore 0x048ae60c -[CALayer layoutSublayers] + 144
16 QuartzCore 0x048a228e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388
17 QuartzCore 0x048a20f2 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18 QuartzCore 0x04894c2b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317
19 QuartzCore 0x048c8c23 _ZN2CA11Transaction6commitEv + 589
20 QuartzCore 0x048ca484 _ZN2CA11Transaction17flush_transactionEv + 50
21 UIKit 0x00eadb55 _UIApplicationHandleEventQueue + 7921
22 CoreFoundation 0x00a3de7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
23 CoreFoundation 0x00a33b0b __CFRunLoopDoSources0 + 523
24 CoreFoundation 0x00a32f28 __CFRunLoopRun + 1032
25 CoreFoundation 0x00a32866 CFRunLoopRunSpecific + 470
26 CoreFoundation 0x00a3267b CFRunLoopRunInMode + 123
27 GraphicsServices 0x04148664 GSEventRunModal + 192
28 GraphicsServices 0x041484a1 GSEventRun + 104
29 UIKit 0x00eb3cc1 UIApplicationMain + 160
30 SampleFMDB 0x000108ea main + 138
31 libdyld.dylib 0x030f6a21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

UITableView crash in iOS 8 on heightForHeaderInSection

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
}

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.

MKMapView unexpected crash issue

In viewDidLoad I have only 2 strings:
MKMapView *mapViewMy = [[MKMapView alloc]init];
[self.view addSubview:mapViewMy];
And the app crashed on "[self.view addSubview:mapViewMy]". I use iOS7. It crashes both on devices and simulators. When I use simulator I have crash report:
2013-11-06 13:34:15.948 MyBex JAPanel[36286:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x0216c5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01eef8b6 objc_exception_throw + 44
2 CoreFoundation 0x0211ebcc -[__NSArrayM insertObject:atIndex:] + 844
3 CoreFoundation 0x0211e870 -[__NSArrayM addObject:] + 64
4 UIKit 0x01190b67 PushNextClassForSettingIMP + 358
5 UIKit 0x0118905e TaggingAppearanceObjectSetterIMP + 43
6 UIKit 0x00d6d8de -[UIViewController _setUpLayoutGuideConstraintIfNecessaryAtTop:] + 424
7 UIKit 0x00d6c1c3 -[UIViewController topLayoutGuide] + 140
8 MapKit 0x023d16a8 -[MKMapView updateLayoutGuides] + 82
9 MapKit 0x023d17e7 -[MKMapView didMoveToSuperview] + 68
10 UIKit 0x00cba636 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 472
11 UIKit 0x00cba388 -[UIView(Hierarchy) _postMovedFromSuperview:] + 260
12 UIKit 0x00cc54c1 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1847
13 UIKit 0x00cb89b1 -[UIView(Hierarchy) addSubview:] + 56
14 UIKit 0x01189077 TaggingAppearanceObjectSetterIMP + 68
15 MyBex JAPanel 0x0001180e -[MapViewController configureView] + 142
16 MyBex JAPanel 0x00011778 -[MapViewController viewDidLoad] + 88
17 UIKit 0x00d71318 -[UIViewController loadViewIfRequired] + 696
18 UIKit 0x00d96b15 -[UINavigationController _layoutViewController:] + 39
19 UIKit 0x00d9702b -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
20 UIKit 0x00d97123 -[UINavigationController _startTransition:fromViewController:toViewController:] + 78
21 UIKit 0x00d9809c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
22 UIKit 0x00d98cb9 -[UINavigationController __viewWillLayoutSubviews] + 57
23 UIKit 0x00ed2181 -[UILayoutContainerView layoutSubviews] + 213
24 UIKit 0x00cc8267 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
25 libobjc.A.dylib 0x01f0181f -[NSObject performSelector:withObject:] + 70
26 QuartzCore 0x005c82ea -[CALayer layoutSublayers] + 148
27 QuartzCore 0x005bc0d4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
28 QuartzCore 0x005bbf40 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
29 QuartzCore 0x00523ae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
30 QuartzCore 0x00524e71 _ZN2CA11Transaction6commitEv + 393
31 QuartzCore 0x005e1430 +[CATransaction flush] + 52
32 UIKit 0x00c79dc9 _afterCACommitHandler + 131
33 CoreFoundation 0x021344ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
34 CoreFoundation 0x0213441f __CFRunLoopDoObservers + 399
35 CoreFoundation 0x02112344 __CFRunLoopRun + 1076
36 CoreFoundation 0x02111ac3 CFRunLoopRunSpecific + 467
37 CoreFoundation 0x021118db CFRunLoopRunInMode + 123
38 GraphicsServices 0x027f29e2 GSEventRunModal + 192
39 GraphicsServices 0x027f2809 GSEventRun + 104
40 UIKit 0x00c5dd3b UIApplicationMain + 1225
41 MyBex JAPanel 0x0003bc0d main + 141
42 libdyld.dylib 0x03423725 start + 0
43 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I checked, both mapViewMy and self.view are not nil.
Its seems like in our viewDidLoad your object is miss referencing
Make sure you have added Framework of MapKit
Import Map Kit & Delegate in your .h file
Try this code :
MKMapView *mapViewMy = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapViewMy.delegate=self;
[self.view addSubview:mapViewMy];
You need to add map kit delegates methods. :)
in .h file
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
//import MKMapkit framwork
#interface mapSampleViewController : UIViewController {
<MKMapViewDelegate>//mapview delegate
{
MKMapView *mapView;
}
in .m file
add this code in viewdidload
mapView= [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
mapView.delegate = self;
[self.view addSubview:mapView];

Crash when installing the app on ipad, works fine in simulator

I am gettting the below issue in my application (Pls help me):
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [1.07157e-08 nan]'
*** Call stack at first throw:
(
0 CoreFoundation 0x3126a64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x32b12c5d objc_exception_throw + 24
2 CoreFoundation 0x3126a491 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x3126a4cb +[NSException raise:format:] + 34
4 QuartzCore 0x32c6f61d _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 140
5 QuartzCore 0x32c6f58b -[CALayer setPosition:] + 38
6 QuartzCore 0x32c6f4d7 -[CALayer setFrame:] + 390
7 UIKit 0x35a31455 -[UIView(Geometry) setFrame:] + 188
8 UIKit 0x35a51743 UIViewCommonInitWithFrame + 594
9 UIKit 0x35a514a1 -[UIView initWithFrame:] + 84
10 CaCaCard 0x0000683b -[CaCaCardsAppViewController shouldAutorotateToInterfaceOrientation:] + 510
11 UIKit 0x35a6eead -[UIViewController _isSupportedInterfaceOrientation:] + 48
12 UIKit 0x35a6ee6f -[UINavigationController _doesTopViewControllerSupportInterfaceOrientation:] + 46
13 UIKit 0x35a6ee37 -[UINavigationController shouldAutorotateToInterfaceOrientation:] + 14
14 UIKit 0x35a6edbf -[UINavigationController _isSupportedInterfaceOrientation:] + 54
15 UIKit 0x35a6fbbb -[UIViewController window:shouldAutorotateToInterfaceOrientation:] + 46
16 UIKit 0x35a6f857 -[UIWindow _shouldAutorotateToInterfaceOrientation:] + 194
17 UIKit 0x35a6f4a3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 366
18 UIKit 0x35a6f0ad -[UIWindow setDelegate:] + 168
19 UIKit 0x35a6efa9 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 64
20 UIKit 0x35a6d611 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 460
21 UIKit 0x35a6d3e5 -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:] + 36
22 UIKit 0x35a4c5a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506
23 UIKit 0x35a4c32f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106
24 UIKit 0x35a31c1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678
25 UIKit 0x35a3196b -[UIView(Hierarchy) addSubview:] + 22
26 CaCaCard 0x00004bcf -[CaCaCardsAppAppDelegate application:didFinishLaunchingWithOptions:] + 318
27 UIKit 0x35a61821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
28 UIKit 0x35a5bb65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
29 UIKit 0x35a307d7 -[UIApplication handleEvent:withNewEvent:] + 1114
30 UIKit 0x35a30215 -[UIApplication sendEvent:] + 44
31 UIKit 0x35a2fc53 _UIApplicationHandleEvent + 5090
32 GraphicsServices 0x31d37e77 PurpleEventCallback + 666
33 CoreFoundation 0x31241a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
34 CoreFoundation 0x3124383f __CFRunLoopDoSource1 + 166
35 CoreFoundation 0x3124460d __CFRunLoopRun + 520
36 CoreFoundation 0x311d4ec3 CFRunLoopRunSpecific + 230
37 CoreFoundation 0x311d4dcb CFRunLoopRunInMode + 58
38 UIKit 0x35a5ad49 -[UIApplication _run] + 372
39 UIKit 0x35a58807 UIApplicationMain + 670
40 CaCaCard 0x000028e7 main + 70
41 CaCaCard 0x0000289c start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.5 (8L1)/Symbols/Developer/usr/lib/libXcod
eDebuggerSupport.dylib (file not found).
(gdb)
-(void) viewWillAppear:(BOOL)animated
//-----------------------------------
{
if ( self.interfaceOrientation == UIInterfaceOrientationPortrait ||
self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown )
{
[NSThread sleepForTimeInterval:0.5];
[UIView beginAnimations:#"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[[UIApplication sharedApplication] setStatusBarOrientation:
UIInterfaceOrientationLandscapeRight];
UIScreen *screen = [UIScreen mainScreen];
CGFloat screenWidth = screen.bounds.size.width;
CGFloat screenHeight = screen.bounds.size.height;
UIView *navView = [[self navigationController] view];
navView.bounds = CGRectMake(0, 0, screenHeight, screenWidth);
navView.transform = CGAffineTransformIdentity;
navView.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
navView.center = CGPointMake(screenWidth/2.0, screenHeight/2.0);
[UIView commitAnimations];
}
fontSelected = NO;
}
The problem is an invalid frame size you are setting at some point. Probably a rect with a zero value somewhere.
From your code I would suspect you are getting some unexpected values back when you are asking for the screen size.
Also don't use those old animation functions. Use the block based animation. It's much better.

Resources