Reputation: 41
I've been trying to figure out what I'm doing wrong for about a whole day now, but I have absolutely no idea why the App always crashes.
The situation is the following:
I've set up a Simple Project with all the required Libraries and Frameworks implemented. I've created several Parse Users with the the following instance method:
[self signUpUserWithName:@"nico" withPassword:@"123"];
[self signUpUserWithName:@"gabriel" withPassword:@"123"];
[self signUpUserWithName:@"bruno" withPassword:@"123"];
Here you can see the method implementation:
-(void)signUpUserWithName:(NSString *)username withPassword:(NSString *)password{
PFUser* user = [PFUser user];
user.password = password;
user.username = username;
[user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if(!error){
NSLog(@"User created.");
}
else{
NSLog(@"User couldn't be created.");
}
}];
}
This works as expected, the users are created and everything is fine. Now I'm logging in a user and create a PFUser Object to the current User with the following code:
[PFUser logInWithUsername:@"user1" password:@"123"];
//Fetching Current User
PFUser* currentUser = [PFUser currentUser];
if ([currentUser isAuthenticated]){
NSLog(@"Authenticated");
}
else{
NSLog(@"Not Authenticated");
}
This also works as expected. The user is logged in and I receive a currentUser Object, which is authenticated. Now I'm trying to get the object of a user with a query and if succeeded, assign the resulting Object to the key "myfriends" of my currentUser (creating a One-To-One Relationship).
PFQuery* friendQuery = [PFUser query];
[friendQuery whereKey:@"username" equalTo:@"user2"];
[friendQuery getFirstObjectInBackgroundWithBlock:^(PFObject *object, NSError *error) {
if(!error){
NSLog(@"%@",object);
currentUser[@"myfriends"] = object;
[currentUser save];
}
else{
NSLog(@"Failed getting User Object.");
}
}];
This also works as expected. If I now open my Data Browser in Parse, I can see that a Pointer to the user2 object was assigned to "myfriends".
But If I relaunch the App, a crash occurs. If I assign something else than a PFUser, for example a PFObject with some data on, to the "myfriends" key of the other PFUser, everything just works fine. No crashes, perfect. But If I'm trying to assign a PFUser, it crashes with the following Message:
2015-01-19 13:44:09.135 localizr[2320:281655] -[__NSCFBoolean _loadSensitiveUserDataFromKeychainItemWithName:]: unrecognized selector sent to instance 0x19967eb60
2015-01-19 13:44:09.136 localizr[2320:281655] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean _loadSensitiveUserDataFromKeychainItemWithName:]: unrecognized selector sent to instance 0x19967eb60'
*** First throw call stack:
(0x188301e48 0x1989fc0e4 0x188308f14 0x188305cc4 0x18820ac1c 0x1000758a4 0x10006f97c 0x10007f25c 0x10007ecbc 0x10007ead4 0x10000d1f8 0x18cb223d0 0x18cd39230 0x18cd3b9b0 0x18cd3a048 0x190565640 0x1882ba124 0x1882b922c 0x1882b742c 0x1881e51f4 0x18cb1b78c 0x18cb16784 0x10000d4c4 0x19906aa08)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
What am I doing wrong? Thanks for your help.
Best wishes Nico
EDIT: Here's the stack trace you asked for:
* thread #1: tid = 0xca4e, 0x0000000196d93270 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000196d93270 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x0000000196e31228 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x0000000196d0ab18 libsystem_c.dylib`abort + 112
frame #3: 0x0000000195df1418 libc++abi.dylib`abort_message + 116
frame #4: 0x0000000195e10b8c libc++abi.dylib`default_terminate_handler() + 304
frame #5: 0x000000019660c3c0 libobjc.A.dylib`_objc_terminate() + 128
frame #6: 0x0000000195e0dbb4 libc++abi.dylib`std::__terminate(void (*)()) + 16
frame #7: 0x0000000195e0d73c libc++abi.dylib`__cxa_rethrow + 144
frame #8: 0x000000019660c294 libobjc.A.dylib`objc_exception_rethrow + 44
frame #9: 0x0000000185df52a4 CoreFoundation`CFRunLoopRunSpecific + 572
frame #10: 0x000000018a72b78c UIKit`-[UIApplication _run] + 552
frame #11: 0x000000018a726784 UIKit`UIApplicationMain + 1488
* frame #12: 0x00000001001015d4 localizr`main(argc=1, argv=0x000000016fd03a68) + 116 at main.m:14
frame #13: 0x0000000196c7aa08 libdyld.dylib`start + 4
Upvotes: 4
Views: 470
Reputation: 17
This issue seems to be resolved with the update to v1.6.3 of the Parse iOS/OS X SDK. Though i have encountered the same problem, i havent updated yet to the new version, so i cannot say yet if it really works...
See this link for the official discussion and response.
Upvotes: 1
Reputation: 1
I removed [Parse enableLocalDatastore] inside my application that was causing the same issue.
Seems to be resolved.
Upvotes: 0