Xcode 5 - No Crash or no console logs - ios

Team,
I got a crash when I perform below actions in my simulator,
> Navigated to Screen1 - > Screen2- > Screen3 -> Screen2 -> screen1
> Press home screen - Go to iPhone Settings screen -> Relaunch my application
> then perform the same steps (Screen1 - > Screen2- > Screen3 -> Screen2 -> screen1)
> perform the same steps Screen1 -> screen2 -> Screen3 -> CRASH on [super viewDidLoad]
I don't see any crash logs or console logs for the crash, but my debugger stops at this point.
Any idea why my application crashes only when I minimized and relaunch the application. If I don't minimize the application, everything works as expected.
Why I am not able to view any console logs for the crash?
Note: We tested on iOS6 device and there is no crash, this is observed only in iOS7 device. I can reproduce the crash only when I minimize the application, else it works fine.
seen this log only once,
2014-04-16 11:42:05.073 ADTCommercial[36614:60b] -[CALayerArray leading]: unrecognized selector sent to instance 0xac1a690
2014-04-16 11:42:05:077 ADTCommercial[36614:60b]
*÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷*
* An Exception Has Been Handled! *
Method:
-[ADT_TaskHomeList(Custom) tableView:didSelectRowAtIndexPath:] -
Exception Name:
NSInvalidArgumentException
Exception Reason:
-[CALayerArray leading]: unrecognized selector sent to instance 0xac1a690
StackTrace:
0 CoreFoundation 0x031af1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x03d7e8e5 objc_exception_throw + 44
2 CoreFoundation 0x0324c243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0319f50b ___forwarding___ + 1019
4 CoreFoundation 0x0319f0ee _CF_forwarding_prep_0 + 14
5 ADTCommercial 0x005aa1d1 +[AMPListScreenTableViewCell getHeightForFont:numberOfLines:] + 113
6 ADTCommercial 0x0059dd80 -[AMPGeneratedListViewController invalidate] + 224
7 ADTCommercial 0x0059e4f8 -[AMPGeneratedListViewController setNumberOfLines:] + 360
8 ADTCommercial 0x0059d28e -[AMPGeneratedListViewController viewDidLoad] + 270
9 ADTCommercial 0x00107208 -[ADT_SystemDetails(Custom) viewDidLoad] + 72
10 UIKit 0x02122e10 -[UIViewController awakeFromNib] + 110
11 UIKit 0x022bbf67 -[UINib instantiateWithOwner:options:] + 1955
12 UIKit 0x022bdada -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
13 ADTCommercial 0x005c1f7b -[AMPViewManager loadView] + 811
14 ADTCommercial 0x005b6916 -[AMPScreenManager showScreen:withRow:createScreen:reloadPolicy:doReset:isModal:animated:navigationController:] + 3542
15 ADTCommercial 0x0058b1ec +[AMPStandardActions gotoAction:reloadPolicy:transactionStateChange:addToHistory:] + 252
16 ADTCommercial 0x002c4935 -[ADT_TaskHomeList(Custom) tableView:didSelectRowAtIndexPath:] + 901
17 UIKit 0x020f09a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
18 UIKit 0x020f0b14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
19 UIKit 0x020f510e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
20 UIKit 0x020240aa ___afterCACommitHandler_block_invoke + 15
21 UIKit 0x02024055 _applyBlockToCFArrayCopiedToStack + 403
22 UIKit 0x02023e76 _afterCACommitHandler + 532
23 CoreFoundation 0x0317736e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x031772bf __CFRunLoopDoObservers + 399
25 CoreFoundation 0x03155254 __CFRunLoopRun + 1076
26 CoreFoundation 0x031549d3 CFRunLoopRunSpecific + 467
27 CoreFoundation 0x031547eb CFRunLoopRunInMode + 123
28 GraphicsServices 0x04e805ee GSEventRunModal + 192
29 GraphicsServices 0x04e8042b GSEventRun + 104
30 UIKit 0x02006f9b UIApplicationMain + 1225
31 ADTCommercial 0x0000642e main + 126
32 libdyld.dylib 0x044c4701 start + 1
33 ??? 0x00000001 0x0 + 1
*÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷*
-(void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PMPCAccountInfoTabScreen *accountsInfoTabScreen = nil;
PMPCJobWrapUp *wrapUpScreen = nil;
NSString *screenPushedUnderJobWrapUp = #"SCREEN_PUSHED_UNDER_WRAP_UP";
#try {
switch (indexPath.row) {
case 0:
// PUSH THE ACCOUNT INFORMATION SCREEN
accountsInfoTabScreen = (PMPCAccountInfoTabScreen*)[[[PMPCScreenManager sharedScreenManager] getScreen:#"PMPCAccountInfoTabScreen"] view];
[accountsInfoTabScreen setSelectedTab:0];
[PMPCStandardActions gotoAction:#"PMPCAccountInfoTabScreen" reloadPolicy:PMPCScreenReloadAlways transactionStateChange:PMPCTransactionContinue addToHistory:YES];
[Commons setClipboardValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:NO]];
break;
case 1:
// PUSH THE JOB DETAILS SCREEN
[PMPCStandardActions gotoAction:#"JobDetailsScreen" reloadPolicy:PMPCScreenReloadAlways transactionStateChange:PMPCTransactionContinue addToHistory:YES];
[Commons setClipboardValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:NO]];
break;
case 2:
//[[PMPCDataClipboard sharedClipboard] setValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:NO]];
[[PMPCDataClipboard sharedClipboard] removeValueForKey:screenPushedUnderJobWrapUp];
[Commons setClipboardValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:NO]];
[PMPCStandardActions gotoAction:#"PMPCSystemDetails" reloadPolicy:PMPCScreenReloadAlways transactionStateChange:PMPCTransactionContinue addToHistory:YES];
break;
case 3:
// Add Items screen
[Commons setClipboardValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:NO]];
[PMPCStandardActions gotoAction:#"PMPCAddedItemsList" reloadPolicy:PMPCScreenReloadAlways transactionStateChange:PMPCTransactionContinue addToHistory:YES];
break;
case 4:
// PUSH THE JOB WRAP UP SCREEN
//JobWrapUpObject *wrapUp = [Commons getJobWrapUpObject];
//[wrapUp resetValues];
wrapUpScreen = (PMPCJobWrapUp*)[[[PMPCScreenManager sharedScreenManager] getScreen:#"PMPCJobWrapUp"] view];
[wrapUpScreen setScrollToTop:YES];
[Commons setClipboardValueForKey:screenPushedUnderJobWrapUp value:[NSNumber numberWithBool:YES]];
[PMPCStandardActions gotoAction:#"PMPCJobWrapUp" reloadPolicy:PMPCScreenReloadAlways transactionStateChange:PMPCTransactionBegin addToHistory:YES];
break;
default:
break;
}
}
#catch (NSException *exception) {
ExceptionLog(exception);
}
#finally {
[PMPCLog trace:#"%s Ends",__PRETTY_FUNCTION__];
}
}
Thanks,
Ramesh

Related

Application crash when close mail composer view in iphone sdk

One of application i am using mail composer for sending mail but unfortunately when i click on send,save or cancel mail then application crash.
Even application only support portrait mode and didn't implemented any code for change orientation.
Code for Mail Composer method :-
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
[mailViewController setMailComposeDelegate:self];
[mailViewController setToRecipients:[NSArray arrayWithObject:MAIL_EMAIL]];
[mailViewController setSubject:MAIL_SUBJECT];
[mailViewController setMessageBody:MAIL_MESSAGE isHTML:NO];
[self presentViewController:mailViewController animated:YES completion:^{
}];
Mail Composer Delegate Method :-
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(#"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(#"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(#"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(#"Mail sent failure: %#", [error localizedDescription]);
break;
default:
break;
}
[controller dismissViewControllerAnimated:YES completion:^{
}];
**Error** :-
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation must return a supported interface orientation!'
*** First throw call stack:
(
0 CoreFoundation 0x0306d1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02dec8e5 objc_exception_throw + 44
2 CoreFoundation 0x0306cfbb +[NSException raise:format:] + 139
3 UIKit 0x01bdb3ec -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 580
4 UIKit 0x01e793d5 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 2330
5 UIKit 0x01bd8bda -[UIViewController _dismissViewControllerWithTransition:from:completion:] + 1647
6 UIKit 0x01bd852e -[UIViewController dismissViewControllerWithTransition:completion:] + 1281
7 UIKit 0x01bd852e -[UIViewController dismissViewControllerWithTransition:completion:] + 1281
8 UIKit 0x01bd9729 -[UIViewController dismissViewControllerAnimated:completion:] + 57
9 TestApp 0x0004c794 -[HelpViewController mailComposeController:didFinishWithResult:error:] + 340
10 MessageUI 0x019ba012 -[MFMailComposeInternalViewController _notifyCompositionDidFinish] + 535
11 MessageUI 0x019b9d98 -[MFMailComposeInternalViewController compositionFinishedWithResult:error:] + 210
12 MessageUI 0x019bbc5d -[MFMailComposeRemoteViewController serviceCompositionFinishedWithResult:error:] + 84
13 CoreFoundation 0x0306191d __invoking___ + 29
14 CoreFoundation 0x0306182a -[NSInvocation invoke] + 362
15 UIKit 0x020d5f0f __63-[_UIViewServiceInterface connection:handleInvocation:isReply:]_block_invoke + 36
16 libdispatch.dylib 0x0336c7b8 _dispatch_call_block_and_release + 15
17 libdispatch.dylib 0x033814d0 _dispatch_client_callout + 14
18 libdispatch.dylib 0x0336f726 _dispatch_main_queue_callback_4CF + 340
19 CoreFoundation 0x030d243e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
20 CoreFoundation 0x030135cb __CFRunLoopRun + 1963
21 CoreFoundation 0x030129d3 CFRunLoopRunSpecific + 467
22 CoreFoundation 0x030127eb CFRunLoopRunInMode + 123
23 GraphicsServices 0x040055ee GSEventRunModal + 192
24 GraphicsServices 0x0400542b GSEventRun + 104
25 UIKit 0x01aacf9b UIApplicationMain + 1225
26 TestApp 0x0001e30d main + 141
27 libdyld.dylib 0x035b670d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Add the following code to your UIViewController subclass (the one you're using to present the mail composer)
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
-(BOOL)shouldAutorotate
{
return NO;
}

How is my code producing this crash: [NSConcreteData count]: unrecognized selector sent to instance

I am getting this crash showing up in BugSense:
-[NSConcreteData count]: unrecognized selector sent to instance 0x14e57f10 - NSInvalidArgumentException
in this code:
+ (NSMutableArray *)applyFilters:(NSMutableArray *)theItems fromFilter:(NSDictionary *)filters
{
NSMutableArray *items = [[NSMutableArray alloc] initWithArray:theItems];
if ([[filters allKeys] count] > 0)
{
NSMutableArray *tempFilteredItems = [[NSMutableArray alloc] init];
for (NSString *key in [filters allKeys])
{
NSMutableString *convertedKey = [NSMutableString stringWithString:key];
[convertedKey replaceOccurrencesOfString:#" "
withString:#"_"
options:NSCaseInsensitiveSearch
range:NSMakeRange(0, [convertedKey length])];
NSArray *tempFilterAttributes = [NSArray arrayWithArray:filters[key]];
for (NSDictionary *item in items)
{
if (![[item[convertedKey] componentsSeparatedByString:#"*"] firstObjectCommonWithArray:tempFilterAttributes])
{
if (![tempFilteredItems containsObject:item])
{
[tempFilteredItems addObject:item];
}
}
}
[items removeObjectsInArray:tempFilteredItems];
[tempFilteredItems removeAllObjects];
}
}
return items;
}
Why/how is this happening?
Stack trace is:
CoreFoundation <redacted> + 130
1 libobjc.A.dylib objc_exception_throw + 38
2 CoreFoundation <redacted> + 202
3 CoreFoundation <redacted> + 706
4 CoreFoundation _CF_forwarding_prep_0 + 24
5 CoreFoundation <redacted> + 28
6 Video Games +[Helper applyFilters:fromFilter:] (Helper.m:2862)
7 Video Games -[WishlistViewController loadUp] (WishlistViewController.m:409) + 29303
8 Video Games -[WishlistViewController viewWillAppear:] (WishlistViewController.m:363) + 27955
9 UIKit <redacted> + 374
10 UIKit <redacted> + 612
11 UIKit <redacted> + 572
12 UIKit <redacted> + 44
13 UIKit <redacted> + 184
14 UIKit <redacted> + 380
15 QuartzCore <redacted> + 142
16 QuartzCore <redacted> + 350
17 QuartzCore <redacted> + 16
18 QuartzCore <redacted> + 228
19 QuartzCore <redacted> + 314
20 UIKit <redacted> + 126
21 CoreFoundation <redacted> + 20
22 CoreFoundation <redacted> + 286
23 CoreFoundation <redacted> + 738
24 CoreFoundation CFRunLoopRunSpecific + 524
25 CoreFoundation CFRunLoopRunInMode + 106
26 GraphicsServices GSEventRunModal + 138
27 UIKit UIApplicationMain + 1136
28 Video Games main (main.m:16) + 888911
29 libdyld.dylib <redacted> + 2
The problem has nothing to do with the code that you provided. The error messages says that the message count was sent to the class NSConcreteData, which is essentially the same as NSData, and such a class method does not exist.
I suggest that you set an exception breakpoint (in Xcode select left the breakpoint navigator, click + left bottom, and select add exception breakpoint).
When you execute the app, it will stop at the faulty instruction.
EDIT (due to the stack trace you provided now):
The stack trace indeed says that your method applyFilters:fromFilter: is responsible for the crash. The only place where the message count is sent in this method, is the statement [[filters allKeys] count]. It looks then that count is sent to an NSConcreteData object, and not to an NSArray object as you might have expected. One reason could be that the argument filters, that should be a NSDictionary, is an object of a different type.
So when the app stops at the exception breakpoint, please check the class of the instance filters.

'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle

I've got a masterdetail application that throws the error;
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle:
'NSBundle </Users/Alex/Library/Application Support/iPhone Simulator/7.1/Applications/A301CCC3-21B3-4AB7-9209-72230036B148/EasyWake.app> (loaded)'
with name 'Ah7-4n-0Wa-view-MMQ-IT-qOo' and directory 'Main.storyboardc''
The masterview consists of a tableview completely constructed programmatically, some cells have buttons, uitextfields, or are standard subtitle cells with disclosure button.
The App loads as expected, & runs as expected for a couple minutes, but afterwards if I select a row, the app will crash.
I cannot figure out why this error is being thrown; searched SO and tried other solutions, checked bundle resources, I've got no known leaks or unused arrays that I know about. If anyone could shed some light on this it would be greatly appreciated.
Cheers, Alex
Error Stacktrace;
*** First throw call stack:(
0 CoreFoundation 0x018861e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016058e5 objc_exception_throw + 44
2 CoreFoundation 0x01885fbb +[NSException raise:format:] + 139
3 UIKit 0x0057ab7b -[UINib instantiateWithOwner:options:] + 951
4 UIKit 0x003e36f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
5 UIKit 0x003e3e9d -[UIViewController loadView] + 302
6 UIKit 0x003e40d3 -[UIViewController loadViewIfRequired] + 78
7 UIKit 0x003e45d9 -[UIViewController view] + 35
8 UIKit 0x003fe942 -[UINavigationController _startCustomTransition:] + 778
9 UIKit 0x0040b8f7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
10 UIKit 0x0040c4e9 -[UINavigationController __viewWillLayoutSubviews] + 57
11 UIKit 0x0054d0d1 -[UILayoutContainerView layoutSubviews] + 213
12 UIKit 0x0af2521b -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] + 50
13 UIKit 0x00334964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
14 libobjc.A.dylib 0x0161782b -[NSObject performSelector:withObject:] + 70
15 QuartzCore 0x0201145a -[CALayer layoutSublayers] + 148
16 QuartzCore 0x02005244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
17 QuartzCore 0x020050b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
18 QuartzCore 0x01f6b7fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
19 QuartzCore 0x01f6cb85 _ZN2CA11Transaction6commitEv + 393
20 QuartzCore 0x01f6d258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
21 CoreFoundation 0x0184e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
22 CoreFoundation 0x0184e2bf __CFRunLoopDoObservers + 399
23 CoreFoundation 0x0182c254 __CFRunLoopRun + 1076
24 CoreFoundation 0x0182b9d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x0182b7eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x021b95ee GSEventRunModal + 192
27 GraphicsServices 0x021b942b GSEventRun + 104
28 UIKit 0x002c5f9b UIApplicationMain + 1225
29 EasyWake 0x00010bfd main + 141
30 libdyld.dylib 0x026b9701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
As requested, the code for select ROW;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.currentCell = indexPath;
switch ([indexPath section]) {
case MACHINES:{
if (self.WOLMachines.count <=0)return;
self.wakeRequested = true;
[self performSegueWithIdentifier:#"showDetail" sender:self];
break;
}
case DISCOVEREDMACHINES:{
if (self.DiscoveredMachines.count <=0)return;
self.wakeRequested = true;
[self performSegueWithIdentifier:#"showDetail" sender:self];
break;
}
case ABOUT:
NSLog(#"About Pressed");
[self performSegueWithIdentifier:#"showInfo" sender:self];
break;
default:
break;
}
}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
self.currentCell = indexPath;
switch ([indexPath section]) {
case MACHINES:{
if (self.WOLMachines.count <=0)return;
self.wakeRequested = false;
[self performSegueWithIdentifier:#"showDetail" sender:self];
break;
}
case DISCOVEREDMACHINES:{
if (self.DiscoveredMachines.count <=0)return;
self.wakeRequested = false;
[self performSegueWithIdentifier:#"showDetail" sender:self];
break;
}
case ABOUT:
NSLog(#"About Pressed");
[self performSegueWithIdentifier:#"showInfo" sender:self];
break;
default:
break;
}
}
The App loads as expected, & runs as expected for a couple minutes, but afterwards if I select a row, the app will crash.
reason: 'Could not load NIB in bundle:
Let's double check the name when you performSegueWithIdentifier:#"showDetail". This name is the same with the name in story board
Turn one all Exception to catch this error.
Hope this helps

SIGABRT error - segmented control

i have a segmented control which, depending on what is selected, is meant to allocate a value to a NS string, as follows:
-(IBAction)driverKnownIndexChanged{
switch (self.driverKnown.selectedSegmentIndex) {
case 0:
driverKnownResponse = #"Yes";
break;
case 1:
driverKnownResponse = #"No";
break;
default:
break;
}
}
however, it is throwing a SIGABRT at the following line:
#import "RoadSafetyAppAppDelegate.h"
int main(int argc, char * argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([RoadSafetyAppAppDelegate class]));
}
}
and here is the console output:
2014-01-30 13:32:16.403 Road Safety App V2[3873:70b] -[DobInAHoonViewController driverKnown:]: unrecognized selector sent to instance 0xcd23440
2014-01-30 13:32:16.409 Road Safety App V2[3873:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DobInAHoonViewController driverKnown:]: unrecognized selector sent to instance 0xcd23440'
*** First throw call stack:
(
0 CoreFoundation 0x01d8f7e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01b0f8e5 objc_exception_throw + 44
2 CoreFoundation 0x01e2c843 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01d7fb0b ___forwarding___ + 1019
4 CoreFoundation 0x01d7f6ee _CF_forwarding_prep_0 + 14
5 libobjc.A.dylib 0x01b2182b -[NSObject performSelector:withObject:] + 70
6 UIKit 0x007d8309 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x007d8295 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x008d90a1 -[UIControl sendAction:to:forEvent:] + 66
9 UIKit 0x008d9496 -[UIControl _sendActionsForEvents:withEvent:] + 577
10 UIKit 0x008d90d6 -[UIControl sendActionsForControlEvents:] + 48
11 UIKit 0x00947572 -[UISegmentedControl _setSelectedSegmentIndex:notify:animate:] + 598
12 UIKit 0x009498c3 -[UISegmentedControl touchesEnded:withEvent:] + 175
13 UIKit 0x00b6ccc3 _UIGestureRecognizerUpdate + 7166
14 UIKit 0x008177ca -[UIWindow _sendGesturesForEvent:] + 1291
15 UIKit 0x008186e1 -[UIWindow sendEvent:] + 1021
16 UIKit 0x007ea542 -[UIApplication sendEvent:] + 242
17 UIKit 0x007d42f3 _UIApplicationHandleEventQueue + 11455
18 CoreFoundation 0x01d18d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
19 CoreFoundation 0x01d1870b __CFRunLoopDoSources0 + 235
20 CoreFoundation 0x01d357ae __CFRunLoopRun + 910
21 CoreFoundation 0x01d34fd3 CFRunLoopRunSpecific + 467
22 CoreFoundation 0x01d34deb CFRunLoopRunInMode + 123
23 GraphicsServices 0x0344f4ed GSEventRunModal + 192
24 GraphicsServices 0x0344f32a GSEventRun + 104
25 UIKit 0x007d6eeb UIApplicationMain + 1225
26 Road Safety App V2 0x00002f9d main + 141
27 libdyld.dylib 0x0308470d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
and Ideas as to why i am having this problem? and a solution would also be appreciated.
This line switch (self.driverKnown.selectedSegmentIndex) { is accessing a property named driverKnown but that driver is unknown. The stack trace and exception are telling you that driverKnown is an undeclared or unknock getter method for the property.
The exception calls out DobInAHoonViewController which in that line of code would be the self. Is driverKnown suppose to be the name of your UISegmentedControl? Can we see the creation of said UISegmentedControl?
your method doesn't know selectedSegmentIndex . because you not value of segment value changed
UISegmentControl *mySegmentedControl = [[UISegmentControl alloc]init];
[mySegmentedControl addTarget:self action:#selector(segmentValueChanged:) forControlEvents:UIControlEventValueChanged];
- (IBAction)segmentValueChanged:(id)sender {
UISegmentedControl *driverKnown = (UISegmentedControl *)sender;
switch (driverKnown.selectedSegmentIndex) {
case 0:
driverKnownResponse = #"Yes";
break;
case 1:
driverKnownResponse = #"No";
break;
default:
break;
}
}

Terminating app due to uncaught exception 'NSRangeException' xcode 5

I got this error in a picker view function that getting its data to a text file from google spreadsheet.. this is the code of the function.
{
- (IBAction)clickText:(id)sender
int tag = [(UITextField*)sender tag];
if (tag!=11)
if (tag!=12)
if (tag!=13)
if (tag!=14)
if (tag!=15)
if (tag!=16)
if (tag!=17)
if (tag!=18)
if (tag!=19)
{
[sender resignFirstResponder];
}
self.myPicker.hidden = NO;
selectedTable = tag;
[sender resignFirstResponder];
float yy = 10;
switch (tag) {
case 11: yy = self.txtTgfeet.frame.origin.y + self.myPicker.frame.size.height;
break;
case 12: yy = self.txtTginches.frame.origin.y + self.myPicker.frame.size.height;
break;
case 13: yy = self.txtTgfraction.frame.origin.y + self.myPicker.frame.size.height;
break;
case 14: yy = self.txtBgfeet.frame.origin.y - self.myPicker.frame.size.height;
break;
case 15: yy = self.txtBginches.frame.origin.y - self.myPicker.frame.size.height;
break;
case 16: yy = self.txtBgfraction.frame.origin.y - self.myPicker.frame.size.height;
break;
case 17: yy = self.txtGravity.frame.origin.y - self.myPicker.frame.size.height;
break;
case 18: yy = self.txtBsw.frame.origin.y - self.myPicker.frame.size.height;
break;
case 19: yy = self.txtTemp.frame.origin.y - self.myPicker.frame.size.height;
break;
default:
break;
}
[self.myPicker setFrame:CGRectMake(self.txtTgfeet.frame.origin.x, yy, self.txtTgfeet.frame.size.width, 216)];
[self.ar removeAllObjects];
NSString *theURL = #"https://docs.google.com/spreadsheet/pub?key=0AobIgii9hBGPdDJ3TmgxSkRzVFBKWXVnTWdQcGtyMFE&single=true&gid=9&output=txt";
NSString *theFile = [NSString stringWithContentsOfURL:[NSURL URLWithString:theURL] encoding:NSUTF8StringEncoding error:nil];
NSLog(#"%#",theFile);
NSArray *theCells = [theFile componentsSeparatedByString:#"\n"];
for (int i=1; i < [theCells count]; i++)
{
// if (i > 0)
{
NSArray *value =[[theCells objectAtIndex:i] componentsSeparatedByString:#"\t"];
[self.ar addObject:[value objectAtIndex:tag+1]];
}
}
[self.myPicker selectRow:0 inComponent:0 animated:NO];
[self.myPicker reloadAllComponents];
This function is working perfectly on the other app, I've made this only for another app that I want this feature. Now when I click the text field I am getting this error:
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 12 beyond bounds [0 .. 8]'
*** First throw call stack:
(
0 CoreFoundation 0x01b575e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018da8b6 objc_exception_throw + 44
2 CoreFoundation 0x01af84e6 -[__NSArrayM objectAtIndex:] + 246
3 TGC 0x000080ba -[MainViewController clickText:] + 4602
4 libobjc.A.dylib 0x018ec81f -[NSObject performSelector:withObject:] + 70
5 UIKit 0x0043d0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
6 UIKit 0x0043d04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
7 UIKit 0x005350c1 -[UIControl sendAction:to:forEvent:] + 66
8 UIKit 0x00535484 -[UIControl _sendActionsForEvents:withEvent:] + 577
9 UIKit 0x00b222ae -[UITextField willAttachFieldEditor:] + 685
10 UIKit 0x0053aeb5 -[UIFieldEditor becomeFieldEditorForView:] + 927
11 UIKit 0x00b193a3 -[UITextField _becomeFirstResponder] + 160
12 UIKit 0x00594ef5 -[UIResponder becomeFirstResponder] + 400
13 UIKit 0x0049819b -[UIView(Hierarchy) becomeFirstResponder] + 114
14 UIKit 0x00b18e43 -[UITextField becomeFirstResponder] + 51
15 UIKit 0x007bd551 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 135
16 UIKit 0x007bfaa2 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 2640
17 UIKit 0x007b3e8c _UIGestureRecognizerSendActions + 230
18 UIKit 0x007b2b00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
19 UIKit 0x007b456d -[UIGestureRecognizer _delayedUpdateGesture] + 60
20 UIKit 0x007b7acd ___UIGestureRecognizerUpdate_block_invoke + 57
21 UIKit 0x007b7a4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
22 UIKit 0x007ae148 _UIGestureRecognizerUpdate + 199
23 UIKit 0x0047a19a -[UIWindow _sendGesturesForEvent:] + 1291
24 UIKit 0x0047b0ba -[UIWindow sendEvent:] + 1030
25 UIKit 0x0044ee86 -[UIApplication sendEvent:] + 242
26 UIKit 0x0043918f _UIApplicationHandleEventQueue + 11421
27 CoreFoundation 0x01ae083f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
28 CoreFoundation 0x01ae01cb __CFRunLoopDoSources0 + 235
29 CoreFoundation 0x01afd29e __CFRunLoopRun + 910
30 CoreFoundation 0x01afcac3 CFRunLoopRunSpecific + 467
31 CoreFoundation 0x01afc8db CFRunLoopRunInMode + 123
32 GraphicsServices 0x031bb9e2 GSEventRunModal + 192
33 GraphicsServices 0x031bb809 GSEventRun + 104
34 UIKit 0x0043bd3b UIApplicationMain + 1225
35 TGC 0x00002d62 main + 130
36 libdyld.dylib 0x022fd725 start + 0
37 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
what is seems to be the problem here?
Here it is clearly mentioned that [__NSArrayM objectAtIndex:]: index 12 beyond bounds [0 .. 8]'
You are trying to access 12th [index 12 and array has 0 to 8 object only] element which is not present, so application is crashing.
Using break point check below line,
[self.ar addObject:[value objectAtIndex:tag+1]];
Your problem seems to be here:
[value objectAtIndex:tag+1]
You are accessing the index 12, when your array value only contains 9 elements.
NSArray *value =[[theCells objectAtIndex:i] componentsSeparatedByString:#"\t"];
if ([value count]>tag+1) {
[self.ar addObject:[value objectAtIndex:tag+1]];
}

Resources