Application crushed : terminating with uncaught exception of type NSException - ios

I'm programming an application in Swift and Objective-C and when I run the test app on the iPhone everything works, but when i was trying to start a call the application crashed showing this:
*** First throw call stack:
(0x181be11b8 0x18061855c 0x181be1100 0x182610eb8 0x100265a2c 0x187acbd30 0x187acbcb0 0x187ab6128 0x187acb59c 0x187acb0c4 0x187ac6328 0x187a96da0 0x18828075c 0x18827a130 0x181b8eb5c 0x181b8e4a4 0x181b8c0a4 0x181aba2b8 0x18356e198 0x187b017fc 0x187afc534 0x1002bc898 0x180a9d5b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) terminating
This is the button code:
- (IBAction)startCallButton:(id)sender {
TCallViewController *callViewController = [[TCallViewController alloc] init];
[self.navigationController pushViewController:callViewController animated:YES];
NSString *handle = [[NSString alloc] initWithString:_handle];
BOOL Video = _video;
if ((handle = callViewController.handle) ){
Video = callViewController.video;
[callManager startCallWithHandle:(handle) video:Video];
}
}
how can I solve this problem?

Related

iOS App Exception - Terminating app due to uncaught exception 'NSInvalidArgumentException'

I am getting the following exception, which is terminating the app.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x7abe4f90'
Following is the code:
- (NSMutableData*)dataForConnection:(URLConnection*)connection {
NSMutableData *data = [receivedData objectForKey:connection.tagKey]; // Exception Here
return data;
}
Could anyone please suggest how to fix it? Thank you in advance!
Problem is due to not allocating receivedData properly, since you have declared it as instance variable, so you should make it using the property declaration like this:
#property(nonatomic, strong) NSMutableDictionary *receivedData;
This will ensure that receivedData does not get released and reference this using self.receivedData in your code.
Maybe this is helpful
[__NSArrayM objectForKey:]
NSArray have not method called objectForKey:
Your object receivedData is NSArray class , change to NSDictionary.

Core Data [Entity length]:

I'm working on an app and it's my first time using Core Data and everything was going smooth until I hit a rock.
Here is my stack trace
2015-07-20 23:39:41.030 Small Things[290:21425] -[Entity1 length]: unrecognized selector sent to instance 0x13769ecb0
2015-07-20 23:39:41.031 Small Things[290:21425] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Entity1 length]: unrecognized selector sent to instance 0x13769ecb0'
*** First throw call stack:
(0x184eaff94 0x199853f2c 0x184eb6cac 0x184eb3c4c 0x184db725c 0x184d97798 0x18a4cce20 0x10005f5f0 0x100063730 0x18a7fdb90 0x18a7fdce8 0x18a7ee890 0x18a802910 0x18a5abe78 0x18a4be4fc 0x189cfad04 0x189cf5920 0x189cf57e0 0x189cf4e80 0x189cf4bd4 0x189cee34c 0x184e66f44 0x184e64cbc 0x184e650ec 0x184d91800 0x18fe1f170 0x18a52a5e8 0x10005f4a0 0x19a08e8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
and here is the code that caused the problem:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
//Fetch data from persistence
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:#"Entity1"];
NSFetchRequest *fetchRequest2 = [[NSFetchRequest alloc] initWithEntityName:#"Entity2"];
self.arr1 = [[managedObjectContext executeFetchRequest:fetchRequest error:nil]mutableCopy];
self.arr2 = [[managedObjectContext executeFetchRequest:fetchRequest2 error:nil]mutableCopy];
[self.tableView reloadData];
}
I really don't get what's wrong.
Thanks in advance
Usually, this error is about the entity name you're using is not kind of NSString, so the code believes that you are using some type else (not NSString).
But it could be also, that is the model associated with the context’s persistent store coordinator does not contain an entity named Entity1.

session invalidated with iOS 8 share extension

I have two targets in my workspace an iOS App (Bundle id: com.gotit.iphone.gotit, App Group: group.com.gotit.iphone.gotit) and an share extension (Bundle id: group.com.gotit.iphone.gotit.Got-it, App Group: group.com.gotit.iphone.gotit).
I can use my share extension without problem but sometimes (not all the time) when I directly come back to my iOS app I have this error and my app crashes :
Attempted to create a task in a session that has been invalidated
2015-07-22 16:31:21.999 iphone[6095:717111] *** Assertion failure in -[BDBOAuth1SessionManager setDelegate:forTask:], /Users/gautier/Documents/Dev/gotit/iOS/iPhone/trunk/iphone/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:449
2015-07-22 16:31:22.001 iphone[6095:717111] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: task'
*** First throw call stack:
(0x1865a02d8 0x1982140e4 0x1865a0198 0x187454ed4 0x100547340 0x1005476d8 0x100549190 0x100522084 0x100520a38 0x1000c94a8 0x1000d9f9c 0x1000d9d8c 0x18b02ff08 0x18b1bb2bc 0x18b0cde84 0x18b0cdc50 0x18b0cdbd0 0x18b0156f4 0x18a951db8 0x18a94c820 0x18a94c6c4 0x18a94be58 0x18a94bbd8 0x18a945300 0x1865582a4 0x186555230 0x186555610 0x1864812d4 0x18fedf6fc 0x18b07ef40 0x1000d6fac 0x1988bea08)
libc++abi.dylib: terminating with uncaught exception of type NSException
I use AFNetworking (with BDBOAuth1SessionManager) and this is how I create my networkManager :
+ (instancetype)create {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[[self class] alloc] init];
});
return _sharedClient;
}
+ (instancetype)sharedClient {
if (!_sharedClient) {
[GotItClient create];
}
return _sharedClient;
}
- (id)init {
self = [super init];
if (self) {
NSURL *baseURL = [NSURL URLWithString:kSCGotItClientAPIURL];
NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:#"group.com.gotit.iphone.gotit"];
sessionConfiguration.sharedContainerIdentifier = #"group.com.gotit.iphone.gotit";
_networkManager = [[BDBOAuth1SessionManager alloc]
initWithBaseURL:baseURL
sessionConfiguration:sessionConfiguration
consumerKey:kSCGotItClientKey
consumerSecret:kSCGotItClientSecret
shareDefaultGroupId:#"group.com.gotit.iphone.gotit"];
_networkManager.responseSerializer = [[AFJSONResponseSerializer alloc] init];
//4 operations at same time
[[_networkManager operationQueue] setMaxConcurrentOperationCount:20];
}
return self;
}
Tell me if you need more code

BlackRaccoon while downloading a file giving error: unrecognized selector sent to instance 0xcd609f0

I am using BlackRaccoon to download a file from FTP server. Following is the code:
- (IBAction)download:(id)sender {
downloadData = [NSMutableData dataWithCapacity: 1];
downloadFile = [[BRRequestDownload alloc] initWithDelegate: self];
downloadFile.path = #"psnewsletter.pdf";
downloadFile.hostname = #"server";
downloadFile.username = #"user";
downloadFile.password = #"pswd";
[downloadFile start];
}
Its gives following error
2014-02-20 11:48:43.526 BlackHillPrimarySchool[2036:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainViewController requestFailed:]: unrecognized selector sent to instance 0xcd609f0'
Any help will be appreciated.
requestFailed: is one of the BRRequest delegate method that you must implement in your view controller.
- (void)requestFailed:(BRRequest *)request {
BRRequestError *reqError = request.error;
// check the error, handle as needed.
}
I'm not sure how your code even compiled. This is a required method of the protocol.

iOS - String error

i've a piece of code that should get the current location and than put lat and long in a string.
when a new location is found i put it in a NSString
currentLatit = [NSString stringWithFormat:#"%f",newLocation.coordinate.latitude];
currentLongit = [NSString stringWithFormat:#"%f",newLocation.coordinate.longitude];
Than when i press a button i do:
NSLog(currentLatit);
[[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString: [NSString stringWithFormat:#"http://maps.google.com/maps?saddr=%#,%#&daddr=%#,%#",currentLatit,currentLongit,detailLatitudine,detailLongitudine]]];
but when i execute this, i get this error:
-[__NSCFArray length]: unrecognized selector sent to instance 0x1e1830
2011-11-15 11:29:07.567 Marcovaldo[771:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray length]: unrecognized selector sent to instance 0x1e1830'
*** First throw call stack:
(0x30ae78bf 0x37c8c1e5 0x30aeaacb 0x30ae9945 0x30a44680 0x30a310a9 0x30ac5a97 0x30a42217 0x30a55b8f 0x37b09b9b 0x37b09b3b 0x7253 0x30a41435 0x32a9c9eb 0x32a9c9a7 0x32a9c985 0x32a9c6f5 0x32a9c321 0x32a8f99b 0x30abbb4b 0x30ab9d87 0x30aba0e1 0x30a3d4dd 0x30a3d3a5 0x3366bfed 0x32aaf743 0x2221 0x21e0)
terminate called throwing an exception(gdb)
The error occur on the NSLog execution
realy cannot understand what's wrong whit this simple code...
thanks for any help
-UPDATE-
changed the NSLog as follow:
NSLog(#"%#",currentLatit);
Now the app crash with BAD_ACCESS_EXCEPTION on the NSLog
No, it seems the app crashed at some point other than NSLog. Please clean and build. Or Enable NSZombie and get the exact error location.
Update:
Just do like as following and try.
if( currentLatit )
[currentLatit release];
if( currentLongit )
[currentLongit release];
currentLatit = [[NSString stringWithFormat:#"%f",newLocation.coordinate.latitude] retain];
currentLongit = [[NSString stringWithFormat:#"%f",newLocation.coordinate.longitude] retain];

Resources