我添加了一个按钮,用于从Parse上的_User数据库中删除用户帐户 . 我使用的代码是这样的:

- (IBAction)deleteButtonPressed:(id)sender {
    UIAlertView *deleteAlert = [[UIAlertView alloc] initWithTitle:@"Delete Confirmation"
                                                          message:@"Are you sure you want to delete this account?"
                                                         delegate:self
                                                cancelButtonTitle:@"No"
                                                otherButtonTitles:@"Yes", nil];
    [deleteAlert show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
        //No Button Code
    }
    if (buttonIndex == 1) {
        //Yes Button Code
        ParseExampleAppDelegate *delegate=[[UIApplication sharedApplication] delegate];
        PFObject *user = [PFObject objectWithoutDataWithClassName:@"_User"
                                                         objectId:delegate.applicationUser.objectId];
        [user deleteEventually];
    }
}

而我得到的错误是这样的:

2015-02-22 21:52:45.374 App[4375:211302] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'User cannot be deleted unless they have been authenticated via logIn or signUp'
First throw call stack:
    (

    0   CoreFoundation                      0x000000010acc0f35 __exceptionPreprocess + 165

    1   libobjc.A.dylib                     0x0000000109a01bb7 objc_exception_throw + 45

    2   CoreFoundation                      0x000000010acc0e6d +[NSException raise:format:] + 205

    3   App                           0x0000000106e2ec51 -[PFUser(Private) checkDeleteParams] + 71

    4   App                           0x0000000106e1ad30 -[PFObject deleteEventually] + 97

    5   App                           0x0000000106e0680d -[ResetPasswordViewController alertView:clickedButtonAtIndex:] + 365

    6   UIKit                               0x00000001073893e0 -[UIAlertView _prepareToDismissForTappedIndex:] + 161

    7   UIKit                               0x0000000107388ede __35-[UIAlertView _prepareAlertActions]_block_invoke50 + 43

    8   UIKit                               0x0000000107382464 -[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:] + 89

    9   UIKit                               0x0000000107171308 -[UIWindow _sendTouchesForEvent:] + 735

    10  UIKit                               0x0000000107171c33 -[UIWindow sendEvent:] + 683

    11  UIKit                               0x000000010713e9b1 -[UIApplication sendEvent:] + 246

    12  UIKit                               0x000000010714ba7d _UIApplicationHandleEventFromQueueEvent + 17370

    13  UIKit                               0x0000000107127103 _UIApplicationHandleEventQueue + 1961

    14  CoreFoundation                      0x000000010abf6551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

    15  CoreFoundation                      0x000000010abec41d __CFRunLoopDoSources0 + 269

    16  CoreFoundation                      0x000000010abeba54 __CFRunLoopRun + 868

    17  CoreFoundation                      0x000000010abeb486 CFRunLoopRunSpecific + 470

    18  GraphicsServices                    0x000000010ab5e9f0 GSEventRunModal + 161

    19  UIKit                               0x000000010712a420 UIApplicationMain + 1282

    20  App                           0x0000000106e077b3 main + 115

    21  libdyld.dylib                       0x000000010e27e145 start + 1

    )

I would very much appreciate some help reagarding how to stop this error from happening and getting the button to delete to work. Thanks for your help.