Storing a PFUser object in a PFUser key crashes

I tried to figure out what I was doing wrong all day, but I absolutely do not know why the application always crashes.

The situation is as follows:

I created a simple project with all the necessary libraries and frameworks. I created several Parse users with the following instance method:

[self signUpUserWithName:@"nico" withPassword:@"123"];
[self signUpUserWithName:@"gabriel" withPassword:@"123"];
[self signUpUserWithName:@"bruno" withPassword:@"123"];

Here you can see the implementation of the method:

-(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.");
        }
    }];

}

It works as expected, users are created, and everything is in order. Now I register the user and create a PFUser object for the current user using the following code:

  [PFUser logInWithUsername:@"user1" password:@"123"];


    //Fetching Current User
    PFUser* currentUser = [PFUser currentUser];
    if ([currentUser isAuthenticated]){
        NSLog(@"Authenticated");
    }
    else{
        NSLog(@"Not Authenticated");
    }

, . , currentUser, . , , " " ( ).

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.");

        }
    }];

, . Parse, , user2 " ".

, . - , PFUser, PFObject , "" PFUser, . , . PFUser, :

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)

? .

EDIT: :

* 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
+4
2

, , 1.6.3 SDK Parse iOS/OS X. , , , ...

. .

+2

[Parse enableLocalDatastore] , .

, .

0

All Articles