iOS Facebook SDK安装 - 应用程序事件
我正在做一场噩梦,试图在iOS上安装Facebook SDK进行应用程序分析。 Facebook文档很糟糕且不一致,我找不到有效的最新安装文档。我要做的就是安装SDK,以便我可以跟踪应用程序安装和应用开放事件。 安装
pod 'Facebook-iOS-SDK'
我正在使用Cocoapods在我的应用程序委托中
import FBSDKCoreKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
Settings.isAutoLogAppEventsEnabled = true
Settings.isAdvertiserIDCollectionEnabled = true
Settings.loggingBehaviors = [LoggingBehavior.appEvents,LoggingBehavior.networkRequests]
return true
}
// ...
}
didfinishlaunchingwithoptions,我的信息中具有以下代码。请按照文档进行以下内容:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb396923698487528</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>396923698487528</string>
<key>FacebookDisplayName</key>
<string>Where4Test</string>
从日志中,它显示了分析事件发送和返回并成功返回到Facebook API。但是在活动中经理
我已经尝试了一百万件不同的事情,但是无法在Facebook上注册这些事件。请有人可以提供最新的安装指令或看到我做错了什么!
I'm having a nightmare trying to install the Facebook SDK on iOS for app events analytics. The facebook documentation is terrible, and inconsistent, and I can't find any up to date installation documents that work. All I want to do is install the SDK so that I can track app installations and app open events. I'm using cocoapods for installation
pod 'Facebook-iOS-SDK'
In my app delegate didFinishLaunchingWithOptions I have the following code
import FBSDKCoreKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
Settings.isAutoLogAppEventsEnabled = true
Settings.isAdvertiserIDCollectionEnabled = true
Settings.loggingBehaviors = [LoggingBehavior.appEvents,LoggingBehavior.networkRequests]
return true
}
// ...
}
In my info.plist I have the following as per the documentation:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb396923698487528</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>396923698487528</string>
<key>FacebookDisplayName</key>
<string>Where4Test</string>
And from the logs it shows the analytics events sending and returning with success to the facebook api. But in the event manager https://www.facebook.com/events_manager2 no events are showing and it says I still haven't installed the SDK.
I've tried a million different things, but just can not get the events to register with facebook. Please can someone give an up to date installation instruction or see something I'm doing wrong!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题的解决方案是向用户请求广告跟踪权限,如下所示。Facebook
文档没有提到这是应用程序事件正常运行所需的安装步骤,但事实证明确实如此。这不是出于任何编码原因,而是出于法律合规性原因。他们确实应该说这是一个必要的步骤,并通知您,如果您未请求授权,则不会在 SDK 日志中跟踪事件。
The solution to this problem was to request ad tracking permissions from the user as follows
Facebook documentation doesn’t mention this as a required installation step for the app events to work, but it turns out it is. This isn’t for any coding reason but instead because of legal compliance reasons. They really should say it is a necessary step and inform you that events won’t be tracked in the SDK logs if you haven’t requested authorisation.