如何在flutter中集成ios平台的facebook应用程序事件

问题描述 投票:0回答:2

我尝试使用 flutter_facebook_sdk 和 flutter_app_events 的插件支持为 ios (flutter) 集成 Facebook 应用程序事件,但没有成功。我可以知道如何在 ios 中实现 Facebook 的这个功能吗?

ios flutter facebook events integration
2个回答
6
投票

首先,您需要在设备中安装 Facebook 应用程序才能在 Facebook 仪表板上查看任何/所有应用程序事件。确保您使用的是真实设备,因为出于某种原因,模拟器不会在 Facebook 分析上发布事件,因为模拟器上未安装 Facebook 应用程序。

其次,要在 IOS 上集成 Facebbok 应用程序事件,只需遵循 pub 文档即可。

首先将项目导入到你的flutter应用程序中:

flutter pub add facebook_app_events

接下来,编辑您的 info.plist (your_project_folder -> ios -> Runner -> Info.plist) 将以下内容添加到您的 info.plist 中:

<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>fb[APP_ID]</string>
  </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>

如果您的代码已包含 CFBundleURLTypes,请插入以下内容:

<array>
 <dict>
 <key>CFBundleURLSchemes</key>
 <array>
   <string>fb[APP_ID]</string>
 </array>
 </dict>
</array>
<key>FacebookAppID</key>
<string>[APP_ID]</string>
<key>FacebookDisplayName</key>
<string>[APP_NAME]</string>

您的 ios 集成到此结束。 接下来将应用程序事件发送到 Facebook:

static final facebookAppEvents = FacebookAppEvents();

static Future<void> sendLoginAnalyticsEvent(
      String userId, String phone) async {
    
    await facebookAppEvents.logEvent(
      name: 'login_user',
      parameters: <String, dynamic>{
        'user_id': userId,
        'user_phone_no': phone,
      },
    );

    print('Successfully Sent loginEvent');
  }

0
投票

我收到此错误

Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_Builtin_float
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_errno
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_math
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_signal
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_stdio
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swift_time
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swiftsys_time
Error (Xcode): Undefined symbol: __swift_FORCE_LOAD_$_swiftunistd
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
© www.soinside.com 2019 - 2024. All rights reserved.