1

我正在開發一個PhoneGap 2.2.0/IOS應用程序,並需要使用FaceBook插件'我按照GIT中所述的安裝過程,當我使用從示例文件夾 「簡單」的樣品我得到的設備準備好對話,告訴我把我的appid到位,我這樣做,然後我按OK和應用程序是通過IOS與此錯誤拋出:PhoneGap/Cordova 2.2.0 Facebook插件在IOS FB.init失敗

'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: No AppID provided; either pass an AppID to init, or add a string valued key with the appropriate id named FacebookAppID to the bundle *.plist' 

,聽到是我FB.init

document.addEventListener('deviceready', function() { 

           try { 
           alert('Device is ready! Make sure you set your app_id below this alert.'); 
           FB.init({ appId: "fb245065455620705", nativeInterface: CDV.FB, useCachedDialogs: false }); 
           document.getElementById('data').innerHTML = ""; 
           } catch (e) { 
           alert(e); 
           } 
           }, false); 

這是項添加到我的plist文件

<key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLName</key> 
      <string>com.mdsitg.amisrael</string> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>fb245065455620705</string> 
      </array> 
     </dict> 
    </array> 

任何幫助,歡迎!

回答

3

你的問題是此行

FB.init({ appId: "fb245065455620705", nativeInterface: CDV.FB, useCachedDialogs: false }); 

它應該是:

FB.init({ appId: "245065455620705", nativeInterface: CDV.FB, useCachedDialogs: false }); 

注意, 「FB」 不應該是應用程序ID的一部分。

+0

這是我第一次嘗試,我刪除它,仍然得到相同的結果,你知道一個很好的示例準備好使用項目的ios,即時消息這個問題4天現在沒有成功 –

+0

,你可以看到我發現我的問題,你的評論是正確的,我沒有提供所有的plist,所以你不能看到我在項目中遇到的所有問題,無論如何,你是對的,你告訴我 –

0

您是否嘗試將FacebookAppID鍵/值添加到您的* -info.plist?

轉到https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/並點擊:

5:配置新的Xcode項目。

向下滾動到:「添加Facebook應用程序ID」

從本質上講,你需要找到你的項目名 - 的info.plist並添加新的鍵/值對。關鍵將是FacebookAppID和價值將是您的應用程序ID 245065455620705(沒有在前面的FB)

1

我發現問題,它在我的projectname.plist上我缺少一個所需的元素,它在實現 謝謝你試圖幫助說明的時候,我現在有一個基地IOS與PhoneGap的/科爾多瓦與Facebook插件的工作2.2.0,如果任何機構需要一個生病很樂意地給它

這是我的plist的源代碼,解決了我的問題

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>CFBundleDevelopmentRegion</key> 
    <string>English</string> 
    <key>CFBundleDisplayName</key> 
    <string>עמישראל</string> 
    <key>CFBundleExecutable</key> 
    <string>${EXECUTABLE_NAME}</string> 
    <key>CFBundleIconFile</key> 
    <string>icon.png</string> 
    <key>CFBundleIconFiles</key> 
    <array> 
     <string>icon-1.png</string> 
     <string>[email protected]</string> 
     <string>icon114.png</string> 
    </array> 
    <key>CFBundleIcons</key> 
    <dict> 
     <key>CFBundlePrimaryIcon</key> 
     <dict> 
      <key>CFBundleIconFiles</key> 
      <array> 
       <string>icon-1.png</string> 
       <string>[email protected]</string> 
       <string>icon114.png</string> 
      </array> 
      <key>UIPrerenderedIcon</key> 
      <false/> 
     </dict> 
    </dict> 
    <key>CFBundleIdentifier</key> 
    <string>com.mdsitg.amisrael</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>6.0</string> 
    <key>CFBundleName</key> 
    <string>${PRODUCT_NAME}</string> 
    <key>CFBundlePackageType</key> 
    <string>APPL</string> 
    <key>CFBundleShortVersionString</key> 
    <string>1.0</string> 
    <key>CFBundleSignature</key> 
    <string>????</string> 
    <key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLName</key> 
      <string>com.mdsitg.amisrael</string> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>fb245065455620705</string> 
      </array> 
     </dict> 
    </array> 
    <key>CFBundleVersion</key> 
    <string>1.0</string> 
    <key>FacebookAppID</key> 
    <string>245065455620705</string> 
    <key>LSRequiresIPhoneOS</key> 
    <true/> 
    <key>NSMainNibFile</key> 
    <string></string> 
    <key>NSMainNibFile~ipad</key> 
    <string></string> 
    <key>UISupportedInterfaceOrientations</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UISupportedInterfaceOrientations~ipad</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
     <string>UIInterfaceOrientationLandscapeLeft</string> 
     <string>UIInterfaceOrientationPortraitUpsideDown</string> 
     <string>UIInterfaceOrientationLandscapeRight</string> 
    </array> 
</dict> 
</plist> 

如果您需要更多幫助,請問我

+0

請告訴我們,你跳過了什麼元素? –

+0

我面臨同樣的問題,請幫助我 –

+0

嗨我更新我的答案,嘗試和幫助你,它在IOS上,我的問題是在plist幾行嗶嗶我會把plist代碼放在更新的答案 –