我正在开发脸书的iOS应用程序。我遇到的问题是没有方法initWithAppID,只有initWithAppID andDelegate:,但我不想在初始化对象时指定委托,因为我是在我的appDelegate和<FBRequestDelegate>中这样做的,即将在我的UIView子类中实现。
所以我的问题是:在哪里初始化Facebook对象更好,在andDelegate:中设置什么更好?
会很感激你的回答,
Artem
发布于 2011-10-25 00:59:07
FBSessionDelegate上的所有方法都被标记为可选的,因此您应该能够将nil作为委托传递。
/**
* Your application should implement this delegate to receive session callbacks.
*/
@protocol FBSessionDelegate <NSObject>
@optional
/**
* Called when the user successfully logged in.
*/
- (void)fbDidLogin;
/**
* Called when the user dismissed the dialog without logging in.
*/
- (void)fbDidNotLogin:(BOOL)cancelled;
/**
* Called when the user logged out.
*/
- (void)fbDidLogout;
@endFacebook类将委托作为已分配的属性,因此您可以稍后设置它。
@property(nonatomic, assign) id<FBSessionDelegate> sessionDelegate;https://stackoverflow.com/questions/7879061
复制相似问题