测试对接
Recommended 👍
Easily test with our SDK wizard
注意
If you prefer not to use our recommended wizard you can find detailed instructions here
Troubleshooting the iOS SDK integration
Installs and events are not recorded
There could be several reasons why installs and events are not recorded:
-
Bad App ID format: If you specify an app ID in the wrong format, installs and events are not recorded. When setting the app ID in the delegate file, make sure that it is comprised of numbers only. In case the app ID is in the wrong format, the log displays the following error:
\[ERROR\] AppsFlyer: -\[AppsFlyerTracker validateAppID\] AppsFlyer Error: appleAppID should be a number!
-
Incorrect App ID: If you specify an app ID that doesn't exist in your account, install and events are not recorded. The log shows the following error:
AppsFlyer: -[AppsFlyerHTTPClient sendRequestEventToServer:isRequestFromCache:appID:isDebug: completionHandler:]_block_invoke sent information to server, status = 404
The 404
error indicates that the SDK is unable to find the app in your account.
-
Bad Dev Key: If you specify an incorrect dev key, installs and events are not recorded. The log shows the following error:
AppsFlyer: -[AppsFlyerHTTPClient sendRequestEventToServer:isRequestFromCache:appID:isDebug:completionHandler:] _block_invoke sent information to server, status = 400
The 400 error indicates that the SDK is unable to authenticate the request to record installs and events. Check that the dev key is the correct one. Also, make sure that the dev key contains only alphanumeric characters.
正确:
[AppsFlyerLib shared].appleAppID = @"340954503";
不正确:
[AppsFlyerLib shared].appleAppID = @"id340954503";
不正确:
[AppsFlyerLib shared].appleAppID = @"com.appslyer.sampleapp";
App ID and dev key are correct but install is not recorded
场景
The app contains the correct app ID and dev key but installs are not recorded.
可能的原因
The SDK is not initiated correctly. Make sure to call the start
method in applicationDidBecomeActive
:
- (void)applicationDidBecomeActive:(UIApplication *)application {
[[AppsFlyerLib shared] start];
}
func applicationDidBecomeActive(application: UIApplication) {
AppsFlyerLib.shared().start()
}
The log shows "AppsFlyer dev key missing or empty. aborting"
场景
You are trying to see installs and in-app events in the log. The log shows "AppsFlyer dev key missing or empty. Aborting".
可能的原因
The dev key is not set. Make sure to set it in appDelegate in the didFinishLaunchingWithOptions
method:
[AppsFlyerLib shared].appsFlyerDevKey = @"<YOUR_DEV_KEY>";
AppsFlyerLib.shared().appsFlyerDevKey = "<YOUR_DEV_KEY>"
安装始终归因于自然安装
场景
You are testing attribution using attribution links. You've implemented the SDK conversion listener but the log always shows that the install is organic. In addition, no non-organic install is recorded in the dashboard.
可能的原因
- The attribution link you are using is incorrect. See our guide on attribution links.
- Make sure that the device you are testing on is registered.
Revenue is not recorded properly
场景
您正在测试具有收入的应用内事件。事件显示在控制面板中,但不记录收入
可能的原因
收入参数的格式不正确。不要给收入值设置任何格式。它不应包含逗号分隔符、货币符号或文本。例如,收入事件应类似于 1234.56。
I'm getting a 404 on install or event recording
场景
You are testing installs and in-app events to see that they are attributed to the correct media source. However, response 404 appears for both install and in-app events. Neither the install nor the in-app events appear in the dashboard.
可能的原因
A 404 response indicates that the app ID is incorrect. See Installs and Events are not recorded.
I get response 400 on install or event recording
场景
您正在尝试在日志中测试应用内事件。触发事件时,在日志中看到响应 400。
可能的原因
This might indicate an issue with the dev key. Check that the dev key is the correct one. Also, make sure that the dev key contains only alphanumeric characters. See Installs and Events are not recorded.
I get response 403 on install or event recording
场景
You are trying to test installs and other conversion events in the log. When you trigger these events, you see response 403 (forbidden) in the logs.
可能的原因
This might be because you have the Zero package, which does not include attribution data; only data on clicks and impressions. To start receiving attribution data, learn more about the different AppsFlyer packages, and update as needed. You can also contact our customer engagement team at [email protected] if you have questions about our packages.
My SDK connection to AppsFlyer is secured by TLS 1.0 or 1.1
To ensure that the connection to AppsFlyer is secured by TLS 1.2 or 1.3 and not by lower TLS versions use the appsflyersdk.com
endpoint without a prefix. Specifically call the setHost function in the following way: setHost("","[appsflyersdk.com](http://appsflyersdk.com/)")
Creating an iOS debug app
可选
You can utilize Xcode's compilation configuration capabilities to configure an easy-to-use debug app. It will enable you to switch between your debug and production apps by tapping into Xcode's active compilation conditions.
注意
If you don't mind mixing production data with test traffic, you can skip to testing the integration. All tests can be performed for both production and debug apps.
This is achieved by configuring a User-Defined Setting in your project's Build Settings and exposing it via an info.plist
property.
Step 1: Add a debug app to AppsFlyer
Add a new pending iOS app to AppsFlyer or ask a team member with dashboard access to add it. Choose any available app ID–You will need it in step 3. Make sure the ID is 9 digits and starts with four 1s, for example, 111167538.
Step 2: Add a User-Defined Setting
- In Xcode, in the file navigator view, select your project root and go to Build Settings.
- Click + in the toolbar and select Add User-Defined Setting. In this case, we name it
AF_APP_ID
. - Expand the newly created User-Defined Setting:
- Set the Debug Conditional Setting to your test app's app ID (mentioned in step 1)
- Set the Release Conditional Setting to your production app's app ID.
Step 3: Expose app IDs via info.plist
Go to the project's info.plist
and add a new property (called AFAppID
in this case). Set its value to $(AF_APP_ID)
(based on the User-Defined Setting name in step 2).
Step 4: Retrieve and set the app ID
To access and use app ID during SDK initialization, add the following code to didFinishLaunchingWithOptions
in your AppDelegate
:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ...
guard let appID : String = Bundle.main.object(forInfoDictionaryKey: "AFAppID") as? String else {
fatalError("Cannot find app ID")
}
AppsFlyerLib.shared().appleAppID = appID
// ...
return true
}
Step 5: Run app using Debug build configuration
To change the active build configuration:
- go to Product > Scheme > Edit Scheme....
- Select Run and change the Build configuration to Debug or Release, as needed.
Now, when you use the Debug configuration to build your app, Xcode will use the debug app ID that you configured in step 2.
已更新 20 days ago