微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Facebook 表示没有为 IOS 安装 SDK

如何解决Facebook 表示没有为 IOS 安装 SDK

我正在使用 React Native 构建移动应用程序,并尝试将 Facebook SDK 与该应用程序集成以跟踪成功的应用程序安装并记录事件。我按照 facebook 文档中提供的完全相同的步骤来集成 sdk (https://developers.facebook.com/docs/app-events/getting-started-app-events-ios)。我在上述参考指南中唯一没有遵循的步骤是步骤 1。

我能够使用我的 android 手机成功记录事件,它甚至显示最近的移动应用程序安装。但是在 IOS 中它不起作用,(没有移动应用程序安装,没有启动,没有事件记录)。我附上了当我去事件调试时它是如何显示的 ss,

enter image description here

它告诉我没有安装 IOS SDK,但我遵循了完全相同的步骤,

这是我的 Info.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>en</string>
    <key>CFBundledisplayName</key>
    <string>newApp</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</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>CFBundLeversion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
    <key>NSCameraUsageDescription</key>
    <string>Need access to your camera</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string></string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Need access to your photo lib</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIrequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
  <key>CFBundleURLTypes</key>
  <array>
    <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fbXXXXXXXXXXXXXXX</string>
    </array>
    </dict>
  </array>
  <key>FacebookAppID</key>
  <string>XXXXXXXXXXXXXX</string>
  <key>FacebookdisplayName</key>
  <string>XXXX</string>
  <key>FacebookAutoLogAppEventsEnabled</key>
  <true/>
  <key>FacebookAdvertiserIDCollectionEnabled</key>
  <true/>
    <key>UIViewControllerBasedStatusBarappearance</key>
    <false/>
  <key>LSApplicationQueriesSchemes</key>
  <array>
    <string>fbauth2</string>
    <string>fb-messenger-share-api</string>
  </array>
</dict>
</plist>

这是我的 Appdelegate.m,

#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>

static void Initializeflipper(UIApplication *application) {
  FlipperClient *client = [FlipperClient sharedClient];
  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] 
  initWithDefaults];


[client addplugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  [client addplugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  [client addplugin:[FlipperKitReactPlugin new]];
  [client addplugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  [client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
  Initializeflipper(application);
#endif

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"newApp"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  [[FBSDKApplicationDelegate sharedInstance] application:application
                             didFinishLaunchingWithOptions:launchOptions];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [FBSDKAppEvents activateApp];
}

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(nonnull NSDictionary<UIApplicationopenURLOptionsKey,id> *)options
{
  [[FBSDKApplicationDelegate sharedInstance] application:application
                                                 openURL:url
                                                 options:options];
  return YES;
}

@end

请注意,我在 facebook 中创建了一个商业应用程序并提供了正确的捆绑标识符。(即使我使用公共 iphone 商店 ID 进行了测试,但结果是一样的)。任何在 IOS 中完成这项工作的解决方案将不胜感激。谢谢!!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。