0
我正在嘗試將Facebook與我的iOS應用程序進行整合。要使用FB SDK,我已經爲這些文件禁用了帶「-fno-objc-arc」的ARC。但是,它仍然有EXC_BAD_ACCESS錯誤,我需要改變如何在登錄後更新UITextView
@property(nonatomic, assign) id<FBSessionDelegate> sessionDelegate;
到
@property(nonatomic, retain) id<FBSessionDelegate> sessionDelegate;
登錄現在工作,但
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
[delegate facebook].accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
[delegate facebook].expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
[defaults synchronize];
}
if (![[delegate facebook] isSessionValid])
{
[[delegate facebook] authorize:nil];
}
}
- (void)fbDidLogin
{
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[[delegate facebook] accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[[delegate facebook] expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
[[delegate facebook] requestWithGraphPath:@"me" andDelegate:self];
}
- (void)request:(FBRequest *)request didLoad:(id)result
{
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
}
if ([result objectForKey:@"name"]) {
self.uitextview.text = [result objectForKey:@"name"];
}
}
我已籤登錄後沒有更新的UITextView 「[result objectForKey:@」name「]」將返回結果,但「self.uitextview」無法識別。
如何成功登錄後更新UITextView?
哪裏是你'self.uilabel'? – 2012-02-24 05:14:40
抱歉,我的意思是uitextview – 2012-02-25 14:04:54