Application crash when close mail composer view in iphone sdk - ios

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;
}

Related

-[XBMessage messageHash]: unrecognized selector sent to instance

I've integrated following library from Cocoapods, You may find the code and its sample code at https://github.com/EugeneNguyen/XBChatModule
pod 'XBChatModule'
This library is used to integrate XMPP Chat in Xcode project.
I also added suggested code from its ReadMe file. For your reference I am pasting it below
AppDelegate.m
[[XBChatModule sharedInstance] setUsername:#"admin"];
[[XBChatModule sharedInstance] setPassword:#"admin"];
[[XBChatModule sharedInstance] setHost:#"sflashcard.com"];
[[XBChatModule sharedInstance] connect];
[[XBChatModule sharedInstance] setAvatarFormat:#"http://dev.sflashcard.com/images/mantis_logo.png?test=%#"];
[[XBChatModule sharedInstance] setAvatarPlaceHolder:[UIImage imageNamed:#"girl_9"]];
The View controller is inherited from XBMessageViewController
ViewController.m
- (void)viewDidLoad
{
self.jidStr = #"binh.nx#sflashcard.com";
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(reloadData) name:#"XBChatModuleNewAvatar" object:nil];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)reloadData
{
[self.collectionView performSelectorOnMainThread:#selector(reloadData) withObject:nil waitUntilDone:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
The code works fine until I send a message. Whenever I press send button, it crashes the app by throwing following error in console
2015-09-01 17:20:41.742 Test[16064:251944] -[XBMessage messageHash]: unrecognized selector sent to instance 0x7ffc91cc4180
2015-09-01 17:20:41.800 Test[16064:251944] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[XBMessage messageHash]: unrecognized selector sent to instance 0x7ffc91cc4180'
*** First throw call stack:
(
0 CoreFoundation 0x000000011260aa75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001122a3bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000112611d1d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001125697ef ___forwarding___ + 495
4 CoreFoundation 0x0000000112569578 _CF_forwarding_prep_0 + 120
5 Test 0x000000010ebaf7ed -[JSQMessagesCollectionViewFlowLayout messageBubbleSizeForItemAtIndexPath:] + 301
6 Test 0x000000010ebb02a7 -[JSQMessagesCollectionViewFlowLayout sizeForItemAtIndexPath:] + 71
7 Test 0x000000010ebc5c93 -[JSQMessagesViewController collectionView:layout:sizeForItemAtIndexPath:] + 131
8 UIKit 0x00000001116369be -[UICollectionViewFlowLayout _getSizingInfos] + 988
9 UIKit 0x0000000111637839 -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 526
10 UIKit 0x00000001116332b7 -[UICollectionViewFlowLayout collectionViewContentSize] + 66
11 Test 0x000000010ebc2d85 -[JSQMessagesViewController scrollToBottomAnimated:] + 325
12 Test 0x000000010ebc2c34 -[JSQMessagesViewController finishReceivingMessageAnimated:] + 388
13 Test 0x000000010ebc2aa0 -[JSQMessagesViewController finishReceivingMessage] + 48
14 Test 0x000000010ebfaac3 -[XBMessageViewController loadDataToTable] + 1507
15 Test 0x000000010ebf9be9 -[XBMessageViewController viewDidLoad] + 73
16 Test 0x000000010ead0760 -[ViewController viewDidLoad] + 96
17 UIKit 0x0000000111104580 -[UIViewController loadViewIfRequired] + 738
18 UIKit 0x000000011110477e -[UIViewController view] + 27
19 UIKit 0x0000000111023509 -[UIWindow addRootViewControllerViewIfPossible] + 58
20 UIKit 0x00000001110238a1 -[UIWindow _setHidden:forced:] + 247
21 UIKit 0x000000011102ff8c -[UIWindow makeKeyAndVisible] + 42
22 UIKit 0x0000000110fda0c2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
23 UIKit 0x0000000110fdce3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
24 UIKit 0x0000000110fdbd35 -[UIApplication workspaceDidEndTransaction:] + 179
25 FrontBoardServices 0x0000000115aab243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
26 CoreFoundation 0x000000011253fc7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
27 CoreFoundation 0x00000001125359c5 __CFRunLoopDoBlocks + 341
28 CoreFoundation 0x0000000112535183 __CFRunLoopRun + 851
29 CoreFoundation 0x0000000112534bc6 CFRunLoopRunSpecific + 470
30 UIKit 0x0000000110fdb7a2 -[UIApplication _run] + 413
31 UIKit 0x0000000110fde580 UIApplicationMain + 1282
32 Test 0x000000010ead06d3 main + 115
33 libdyld.dylib 0x0000000112b3c145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I understand it says, that I haven't implemented the function messageHash in Class XBMessage , but the same code works fine in the sample code that I download from Github. Kindly help me to solve this error.
The library that XBChatModule is based on has since been updated. If you look at the history of the protocol that XBMessage conforms to: https://github.com/jessesquires/JSQMessagesViewController/commits/develop/JSQMessagesViewController/Model/JSQMessageData.h you can see that the method messageHash has been made required since the XBChatModule was written.
As such, I recommend contacting the developers of XBChatModule and get them to update their code or, alternatively, implement your own messageHash method.

'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

Xcode 5 - No Crash or no console logs

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

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;
}
}

ABPeoplePickerNavigationController crashed while presentviewcontroller

Some one help me to fix this crash issue. I am not able to get the root cause of it.
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
[self presentViewController:picker animated:YES completion:nil];
And I am getting the below crash, not sure why,
-[ABPeoplePickerNavigationController masterViewController]: unrecognized selector sent to instance 0xdd8cd40
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ABPeoplePickerNavigationController masterViewController]: unrecognized selector sent to instance 0xdd8cd40'
*** First throw call stack:
(
0 CoreFoundation 0x03b5e5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x031f28b6 objc_exception_throw + 44
2 CoreFoundation 0x03bfb903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x03b4e90b ___forwarding___ + 1019
4 CoreFoundation 0x03b4e4ee _CF_forwarding_prep_0 + 14
5 UIKit 0x0271f544 -[UISearchDisplayController _areSearchContentsSplitViewMaster] + 63
6 UIKit 0x0271f6ac -[UISearchDisplayController _configureNewSearchBar] + 307
7 UIKit 0x0271ee63 -[UISearchDisplayController initWithSearchBar:contentsController:searchResultsTableViewStyle:] + 121
8 UIKit 0x0271ede5 -[UISearchDisplayController initWithSearchBar:contentsController:] + 55
9 AddressBookUI 0x03dffe5e -[ABMembersController contentView] + 1223
10 AddressBookUI 0x03e05d3e -[ABMembersViewController updateView] + 57
11 AddressBookUI 0x03e058b0 -[ABMembersViewController loadView] + 36
12 UIKit 0x0249d73e -[UIViewController loadViewIfRequired] + 78
13 UIKit 0x024c31a5 -[UINavigationController _layoutViewController:] + 39
14 UIKit 0x024c36bb -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
15 UIKit 0x024c37b3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 78
16 UIKit 0x024c472c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
17 UIKit 0x024c5349 -[UINavigationController __viewWillLayoutSubviews] + 57
18 UIKit 0x025fe39d -[UILayoutContainerView layoutSubviews] + 213
19 UIKit 0x024c1592 __53-[UINavigationController setNeedsDeferredTransition:]_block_invoke + 45
20 UIKit 0x023a6d33 ___afterCACommitHandler_block_invoke + 15
21 UIKit 0x023a6cde _applyBlockToCFArrayCopiedToStack + 403
22 UIKit 0x023a6b0a _afterCACommitHandler + 532
23 CoreFoundation 0x03b2653e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x03b2648f __CFRunLoopDoObservers + 399
25 CoreFoundation 0x03b043b4 __CFRunLoopRun + 1076
26 CoreFoundation 0x03b03b33 CFRunLoopRunSpecific + 467
27 CoreFoundation 0x03b0394b CFRunLoopRunInMode + 123
28 GraphicsServices 0x04df39d7 GSEventRunModal + 192
29 GraphicsServices 0x04df37fe GSEventRun + 104
30 UIKit 0x0238a94b UIApplicationMain + 1225
31 ShowRoomPrive 0x0026dfd5 main + 181
32 ShowRoomPrive 0x00002ba5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException
use below code i think you had not added delegate and may this help you..
ABPeoplePickerNavigationController *picker =
[[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentViewController:picker animated:YES completion:nil];
or go through this url its will give you step by tutorial how to use it
http://yuvarajmanickam.wordpress.com/2012/09/19/get-contact-number-from-abpeoplepickernavigationcontroller-ios-apps/
or with apple documentation it is show helpfull
https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/QuickStart.html

Resources