React native 让本机FacebookSDK正常工作

React native 让本机FacebookSDK正常工作,react-native,fbsdk,react-native-fbsdk,React Native,Fbsdk,React Native Fbsdk,我正在尝试让FBSDK在本机项目中运行 我react native init AwesomeProject要获得一个全新的项目,遵循github上的操作,我在main.m中得到一个错误: thread 1:signal SIGABRT 然后,通过谷歌搜索,我将lsapplicationqueryschemes键添加到我的info.plist。解决这个问题 然后,我按照要求添加一个NSAppTransportSecurity密钥到我的info.plist`。但是应用程序无法连接到开发服务器 再搜

我正在尝试让FBSDK在本机项目中运行

react native init AwesomeProject
要获得一个全新的项目,遵循github上的操作,我在
main.m
中得到一个错误:

thread 1:signal SIGABRT
然后,通过谷歌搜索,我将
lsapplicationqueryschemes
键添加到我的
info.plist
。解决这个问题

然后,我按照要求添加一个
NSAppTransportSecurity
密钥到我的info.plist`。但是应用程序无法连接到开发服务器

再搜索一下,我发现上面说我不需要
NSAppTransportSecurity
键,所以我把它拿出来,应用程序就可以运行了。呼,问题解决了

回到前面,我抓住了他们用法部分的第一个例子;登录按钮。将其逐字复制到我的应用程序中。它运行。我点击它。而且

thread 1:signal SIGABRT


有人用过这个吗

我有!安装SDK后,需要确保所有配置都是属性集。您还需要在AppDelegate中导入sdk

以下是我的info.plist中的相关配置

<key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb12345678910</string>
      </array>
    </dict>
  </array>
  <key>FacebookAppID</key>
  <string>12345678910</string>
  <key>FacebookDisplayName</key>
  <string>My Awesome App</string>


  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSExceptionDomains</key>
    <dict>
      <key>facebook.com</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
      </dict>
      <key>fbcdn.net</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>  <false/>
      </dict>
      <key>akamaihd.net</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
      </dict>
      <key>localhost</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
      </dict>
      <key>api.mydomain.com</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
      </dict>
    </dict>
  </dict>


  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
  </array>
通过这些配置,我可以连接我的服务器、登录用户等


祝你好运

我有!安装SDK后,需要确保所有配置都是属性集。您还需要在AppDelegate中导入sdk

以下是我的info.plist中的相关配置

<key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>fb12345678910</string>
      </array>
    </dict>
  </array>
  <key>FacebookAppID</key>
  <string>12345678910</string>
  <key>FacebookDisplayName</key>
  <string>My Awesome App</string>


  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSExceptionDomains</key>
    <dict>
      <key>facebook.com</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
      </dict>
      <key>fbcdn.net</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>  <false/>
      </dict>
      <key>akamaihd.net</key>
      <dict>
        <key>NSIncludesSubdomains</key> <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
      </dict>
      <key>localhost</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
      </dict>
      <key>api.mydomain.com</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/>
      </dict>
    </dict>
  </dict>


  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
  </array>
通过这些配置,我可以连接我的服务器、登录用户等


祝你好运

真棒的回答!现在可以完美地运行和登录。看起来我在info.plist中犯了一个错误。但现在我有另一个问题,如果你能看一看,你可能知道答案:。谢谢。回答得真棒!现在可以完美地运行和登录。看起来我在info.plist中犯了一个错误。但现在我有另一个问题,如果你能看一看,你可能知道答案:。谢谢