我想給Facebook的iOS SDK集成在我的應用程序,在我的應用程序委託頭我做了以下內容:我的Facebook應用程序崩潰,驗證畫面駁回
#import <UIKit/UIKit.h>
#import "Facebook.h"
#import "FBConnect.h"
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
Facebook *facebook;
}
@property (nonatomic,strong) Facebook *facebook;
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end
,並在實現文件的方法didFinishLaunchingWithOptions方法:
MyFacebooDelegate *controllerDelegate = [[MyFacebooDelegate alloc] init];
facebook = [[Facebook alloc] initWithAppId:appID andDelegate:controllerDelegate];
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
if([userDefault objectForKey:@"FBAccessTokenKey"] && [userDefault objectForKey:@"FBExpirationDateKey"])
{
facebook.accessToken = [userDefault objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [userDefault objectForKey:@"FBExpirationDateKey"];
}
if(![facebook isSessionValid])
{
NSArray *permision = [[NSArray alloc]initWithObjects:@"read_stream",nil] ;
[facebook authorize:permision];
}
其中MyFacebooDelegate類是我實現Facebook的代表像FBSessionDelegate等。
我也處理的handleOpenURL和的OpenURL過,當我運行的應用程序,我得到了Facebook在Safari瀏覽器進行身份驗證屏幕,然後按「好」屏幕開除,回到我的應用程序,但有些時候的應用程序崩潰和退出而這裏是編譯器告訴我的錯誤:
- (void)fbDialogLogin:(NSString *)token expirationDate:(NSDate *)expirationDate {
self.accessToken = token;
self.expirationDate = expirationDate;
[_lastAccessTokenUpdate release];
_lastAccessTokenUpdate = [[NSDate date] retain];
[self reloadFrictionlessRecipientCache];
if ([self.sessionDelegate respondsToSelector:@selector(fbDidLogin)]) {
[self.sessionDelegate fbDidLogin];
}
具體的編譯器指示該行:
if ([self.sessionDelegate respondsToSelector:@selector(fbDidLogin)]) {
任何幫助將不勝感激
sessionDelegate指的是什麼類型的值?這是一個弱或強大的財產?你會得到什麼樣的錯誤? –
崩潰的具體錯誤是什麼? –
你的明確錯誤是什麼? – brush51