Use sharesdk to log on to facebook, sharesdkfacebook
Use sharesdk for facebook login by Wu xueying
Using sharesdk to log on to facebook (you can also directly use Facebook-sdk-ios, but using sharesdk is relatively simple) is troublesome for Chinese apps to join facebook because vpn should be configured, after configuring the vpn, the network speed is slow.
1. Download sharesdk :( only download part of facebook, otherwise the package size will be large) http://sharesdk.mob.com/Download
2. Add the sdk to the project and add the dependent library SystemConfiguration. frameworkQuartzCore. frameworkCoreTelephony. frameworklibicucore. dyliblibz.1.2.5.dylibSecurity. framework
3. reference the registration code (register your own appkey) [ShareSDKregisterApp: @ "5577ff992136"]; [ShareSDKconnectFacebookWithAppKey: @ "107704292745179" appSecret: @ "secret"];
4. Returned webpage call-(BOOL) application :( UIApplication *) application
HandleOpenURL :( NSURL *) url
{
Return [ShareSDKhandleOpenURL: url
WxDelegate: self];
}
-(BOOL) application :( UIApplication *) application
OpenURL :( NSURL *) url
SourceApplication :( NSString *) sourceApplication
Annotation :( id) annotation
{
Return [ShareSDKhandleOpenURL: url
SourceApplication: sourceApplication
Annotation: annotation
WxDelegate: self];}
5. Add a facebook key
6. call-(IBAction) facebookLogin :( id) sender {[ShareSDKgetUserInfoWithType: ShareTypeFacebook autexceptions: nil result: ^ (BOOL result, id <ISSPlatformUser> userInfo, id <ICMErrorInfo> error) {NSLog (@ "% @", [userInfosourceData]); if (result ){}
}];}