FacebookDialog.canPresentShareDialog始终为空

时间:2015-03-01 18:25:29

标签: android facebook

我试图拍照并在Facebook上分享。

private void facebookPublishFeedDialog(Bitmap bitmap2) {
        images.add(bitmap2);        
        if (FacebookDialog.canPresentShareDialog(getActivity(),FacebookDialog.ShareDialogFeature.PHOTOS)) {
              // Publish the post using the Photo Share Dialog
              FacebookDialog shareDialog = new FacebookDialog.PhotoShareDialogBuilder(getActivity())
                .addPhotos(images)
                .build();

               }  
           }

尝试获取canPresentShareDialog时崩溃。 我的SDK版本是3.23 我已将其添加到我的清单中:

<provider
            android:name="com.facebook.NativeAppCallContentProvider"
            android:authorities="com.facebook.app.NativeAppCallContentProvider11111"
            android:exported="true" />

日志:

03-02 23:18:42.850: E/AndroidRuntime(11457): Process: com.example.zollisapp, PID: 11457
03-02 23:18:42.850: E/AndroidRuntime(11457): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65636, result=-1, data=Intent { act=inline-data dat=file:///storage/emulated/0/DCIM/Cymera2/CYMERA_20150302_231841.jpg (has extras) }} to activity {com.example.zollisapp/com.example.zollisapp.Deals}: java.lang.NullPointerException
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3389)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3432)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.app.ActivityThread.access$1300(ActivityThread.java:144)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1253)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.os.Handler.dispatchMessage(Handler.java:102)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.os.Looper.loop(Looper.java:136)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.app.ActivityThread.main(ActivityThread.java:5146)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at java.lang.reflect.Method.invokeNative(Native Method)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at java.lang.reflect.Method.invoke(Method.java:515)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at dalvik.system.NativeStart.main(Native Method)
03-02 23:18:42.850: E/AndroidRuntime(11457): Caused by: java.lang.NullPointerException
03-02 23:18:42.850: E/AndroidRuntime(11457):    at com.example.zollisapp.DealFragmentA.facebookPublishFeedDialog(DealFragmentA.java:198)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at com.example.zollisapp.DealFragmentA.onActivityResult(DealFragmentA.java:153)
03-02 23:18:42.850: E/AndroidRuntime(11457):    at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:166)

由于

1 个答案:

答案 0 :(得分:1)

确保您的应用程序ID已在清单中设置