Evernote / evernote-sdk-ios

Evernote SDK for iOS
Other
398 stars 130 forks source link

Zombie object when trying to authenticate without internet connection #98

Closed ShadyGhalab closed 7 years ago

ShadyGhalab commented 10 years ago

I got this zombie object when i trying to authenticate without internet connection.

-[__NSDictionaryM objectForKey:]: message sent to deallocated

this is my Authentication Code

-(void)EverNoteIntegrate:(UISwitch *)everNote{

[[GAI sharedInstance].defaultTracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Setting" action:@"Evernote" label:everNote.on?@"YES":@"Close" value:nil]build]];

if (everNote.on) {

    [[EverNoteSync sharedClient] initlize:self WithStatus:^(BOOL status) {

        if (status) {

            if (![AppLocalData isBefoEvernoteNoteBook]) {

                if ([SDCloudUserDefaults stringForKey:@"BefoNotebookGUID"]) {
                    [AppLocalData setEvernoteBefoNotebookGUID:[SDCloudUserDefaults stringForKey:@"BefoNotebookGUID"]];
                    [AppLocalData setBefoNoteBookForEverNote:YES];
                }else{

                    [EverNoteSync createBefoNoteBook:^(BOOL noteBookstatus,NSError *error) {

                        if (!error) {
                            if (noteBookstatus) {
                                [AppLocalData setBefoNoteBookForEverNote:noteBookstatus];
                            }else{
                                [AppLocalData setBefoNoteBookForEverNote:NO];
                            }
                        }else{
                            if (error.code == 10 && [[error.userInfo valueForKey:@"parameter"]isEqualToString:@"Notebook.name"]) {
                                [AppLocalData setEvernoteBefoNotebookGUID:[SDCloudUserDefaults stringForKey:@"BefoNotebookGUID"]];
                                [AppLocalData setBefoNoteBookForEverNote:YES];
                            }
                        }

                    }];

                }

            }

        }else{
            everNote.on = NO;
        }
    }];

}else{
    [[EvernoteSession sharedSession] logout];

}

}

screen shot 2014-05-26 at 2 23 16 pm

screen shot 2014-05-26 at 2 23 34 pm