iOSアプリでFacebook経由でログインするためにデバイスにインストールされている場合、Facebookアプリを使用したいと考えています。今、アプリがインストールされているかどうか、Safariブラウザにリダイレクトされていますか?Facebook sdkがログイン済みのiOS 10.0に既にインストールされているアプリケーションを使用していない
ご協力いただければ幸いです。
ありがとうございました。
iOSアプリでFacebook経由でログインするためにデバイスにインストールされている場合、Facebookアプリを使用したいと考えています。今、アプリがインストールされているかどうか、Safariブラウザにリダイレクトされていますか?Facebook sdkがログイン済みのiOS 10.0に既にインストールされているアプリケーションを使用していない
ご協力いただければ幸いです。
ありがとうございました。
Facebookログインのポリシーが変更されました。 iOSの10
と間違って何も参照してください - あなたは以下のようにネイティブに動作を与える必要がありhttps://developers.facebook.com/docs/facebook-login/ios
。
login.loginBehavior = FBSDKLoginBehaviorNative;
Facebookのアプリを持っていない場合は、1つを確認してください。
だから使い方が良いです。あなたのログインビューコントローラのFacebookログインページがアプリ内でのみ開かれます。
login.loginBehavior = FBSDKLoginBehaviorWeb;
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior = FBSDKLoginBehaviorNative;
[login
logInWithReadPermissions: @[@"public_profile",@"email"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
}
else if (result.isCancelled)
{
NSLog(@"Cancelled");
}
else {
if ([FBSDKAccessToken currentAccessToken]) {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"email, name"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"fetched user:%@", result);
}
}];
}
}
}];
ちょうどFBSDKLoginBehaviorNativeをクリックしてサンプルコード、それはあなたが
が正しくそれを読み、理解FacebookLoginManager.hにつながるだろう。
typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior)
{
/*!
@abstract This is the default behavior, and indicates logging in through the native
Facebook app may be used. The SDK may still use Safari instead.
*/
FBSDKLoginBehaviorNative = 0,
/*!
@abstract Attempts log in through the Safari or SFSafariViewController, if available.
*/
FBSDKLoginBehaviorBrowser,
/*!
@abstract Attempts log in through the Facebook account currently signed in through
the device Settings.
@note If the account is not available to the app (either not configured by user or
as determined by the SDK) this behavior falls back to \c FBSDKLoginBehaviorNative.
*/
FBSDKLoginBehaviorSystemAccount,
/*!
@abstract Attempts log in through a modal \c UIWebView pop up
@note This behavior is only available to certain types of apps. Please check the Facebook
Platform Policy to verify your app meets the restrictions.
*/
FBSDKLoginBehaviorWeb,
};
Hello @Hasya、返信ありがとうございますがコードは試しましたが、ネイティブiOSアプリがインストールされているとログインできませんでした。私はアプリがインストールされているかのようにしたいと思う、それはブラウザにリダイレクトされた他のFacebookのアプリケーションを開く – puja
NSURL * URL = [NSURL URLWithString:@ "FB://プロファイル/"]; [[UIApplication sharedApplication] openURL:url]; if([[UIApplication sharedApplication] canOpenURL:nsurl]){ [[UIApplication sharedApplication] openURL:nsurl]; } else { //通常通りURLを開きます } –