iOS初學者在這裏。我使用下面的代碼保存我的Facebook的accessToken和EXPIRATIONDATE NSUserDefaults的中:在iOS的NSUserDefaults中保存Facebook access_token
facebook = [[Facebook alloc] initWithAppId:@"225083222506272"];
[facebook authorize:nil delegate:self];
NSString *access=[facebook accessToken];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:access, @"accessToken",[facebook expirationDate], @"expirationDate",nil];
[defaults registerDefaults:appDefaults];
我試圖找回的accessToken和到期日期與以後調用:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *access=[defaults valueForKey:@"accessToken"];
NSDate *date=[defaults objectForKey:@"expirationDate"];
[facebook fbDialogLogin:access expirationDate:date];
但訪問和日期爲空。我究竟做錯了什麼?
NSLog你的訪問NSString。它是否返回一個值? – shabbirv 2011-05-17 01:06:51
是的,它返回null – John 2011-05-17 01:21:27
爲什麼它返回null?它應該返回一個值... – bobbypage 2011-05-17 01:33:36