我正在尝试让FBSDK在一个iOS ReactNative项目中运行。
我react-native init AwesomeProject
以获得一个全新的项目,遵循github上的响应本机FBSDK指令,在main.m
中得到一个错误
thread 1:signal SIGABRT
稍微谷歌一下,我就可以看到这里,然后是这里,它让我在info.plist
上添加了一个LSApplicationQueriesSchemes
键。解决那个问题。
然后,我遵循Facebook应用程序安装指南,它让我向我的info.plist`添加了一个NSAppTransportSecurity
键。但是应用程序无法连接到开发服务器。
再谷歌一下,我发现此页说我不需要NSAppTransportSecurity
键,所以我把它拿出来,然后应用程序就运行了。问题解决了。
回到响应本机FBSDK github页面中,我在它们的用法部分获得了第一个示例: LoginButton。逐字复制到我的应用程序中。它在跑。我点击它。还有..。
thread 1:signal SIGABRT
啊!
有人成功了吗?
发布于 2016-04-28 17:42:20
我有过!安装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>
有三节:
localhost
包括在列表中。这是我的AppDelegate.m
文件。
```javascript
#导入"RCTRootView.h“
#import
@implementation AppDelegate
/**
/**
localhost
更改为计算机的IP地址。ifconfig
并选择inet
值在en0:
下),并确保计算机和iOS设备URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true";= NSURL jsCodeLocation
/**
// jsCodeLocation = [NSBundle mainBundle URLForResource:@main“main”main:@“jsbundle”];
RCTRootView *rootView = [RCTRootView alloc initWithBundleURL:jsCodeLocation
moduleName:@"MyAwesomeApp"
initialProperties:nil
launchOptions:launchOptions];
self.window = [UIWindow alloc initWithFrame:UIScreen mainScreen.bounds];
UIViewController *rootViewController = UIViewController;
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
self.window makeKeyAndVisible;
回答“是”;
}
/**
@end
有了这些配置,我就可以连接到我的服务器,登录用户等。
祝好运!
https://stackoverflow.com/questions/36904245
复制相似问题