IOS,Android-Facebook分享

Fackbook

新建应用:

https://developers.facebook.com

对外开放

IOS,Android-Facebook分享_第1张图片

审核通过publish_actions

IOS提交模拟器版本,Unity中选择Mono2x,Simulator SDK,禁用部分第三方SDK
sim_build

IOS

导入UMSDK,导入facebook-sdk

设置url Schemes


        <dict>
            <key>CFBundleTypeRolekey>
            <string>Editorstring>
            <key>CFBundleURLNamekey>
            <string>fbstring>
            <key>CFBundleURLSchemeskey>
            <array>
                <string>fbxxxxxxxxxxxxxxxstring>
            array>
        dict>

添加url Schemes白名单

        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbauth</string>
        <string>fbshareextension</string>

编辑其他plist

        <key>FacebookAppIDkey>
        <string>xxxxxxxxxxxxxxxstring>
        <key>FacebookDisplayNamekey>
        <string>XXXXXXXXXXXstring>

初始化

//设置友盟appkey
    [[UMSocialManager defaultManager] setUmSocialAppkey:@"xxxxxxxxxxxxxxx"];
    [[UMSocialManager defaultManager] openLog:YES];
//设置Facebook的appKey和UrlString
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Facebook appKey:@"xxxxxxxxxxxxxxx"  appSecret:nil redirectURL:@"http://fir.im/minelost"];

开启Keychain Sharing

IOS,Android-Facebook分享_第2张图片

Android

Facebook后台设置

包名(com.xxxx.xxxx)
类名[应用主要的Activity](com.xxxx.xxxx.xxActivity)
密钥散列:

keytool -exportcent -alias androiddebugkey -keystore xxxx.keystore | openssl sha1 -binary | openssl base64

配置AndroidManifest

<activity
        android:name="com.umeng.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <provider
        android:name="com.umeng.facebook.FacebookContentProvider"
        android:authorities="com.facebook.app.FacebookContentProviderxxxxxxxxxxxxxxx"
        android:exported="true" />

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />

你可能感兴趣的:(Unity,IOS)