2011-10-18 48 views
1

我想要在我的應用程序內對Facebook進行身份驗證,然後以編程方式在某人身上發帖,然後開始使用我的應用程序。 iPhone上可以這樣做嗎?有什麼中央認證模塊的iPhone從我可以使用令牌訪問Facebook?我不希望新用戶需要在我的應用程序中輸入憑據,然後再次輸入憑證到Facebook。在iPhone上使用Facebook進行身份驗證

感謝,馬切伊

+0

看一看OAuth – Rob

回答

1

看一看 http://developers.facebook.com/docs/authentication/

的方法你我會打電話給Facebook.m。這裏有一個例子:

[self.facebook authorizeWithPermissions:somePermissions delegate:self]; 

一旦你叫authorizeWithPermissions,您會收到一些委託回調:

/** 
* Called when the user has logged in successfully. 
*/ 
- (void)fbDidLogin 
{ 
    // Do something with self.facebook.expirationDate and self.facebook.accessToken 
} 

隨着self.facebook.expirationDateself.facebook.accessToken,您可能希望將它們保存在NSUserDefaults所以用戶不必每次重新授權。