AppsFlyerLib
总览
AppsFlyerLib
是AppsFlyer iOS SDK的主类,包含了大部分方法。
To import AppsFlyerLib
:
// AppDelegate.h
#import <AppsFlyerLib/AppsFlyerLib.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, AppsFlyerLibDelegate>
@end
import AppsFlyerLib
回到SDK参考索引。
属性
advertisingIdentifier (read-only)
属性声明
@property(nonatomic, strong, readonly) NSString *advertisingIdentifier
描述
AppsFlyer SDK collect Apple's advertisingIdentifier
if the AdSupport.framework
included in the SDK.
You can disable this behavior by setting the disableAdvertisingIdentifier
to true
.
类型 | 名称 |
---|---|
NSString | advertisingIdentifier |
anonymizeUser
属性声明
@property(atomic) BOOL anonymizeUser;
描述
选择退出特定用户记录
类型 | 名称 |
---|---|
bool | anonymizeUser |
appInviteOneLinkID
属性声明
@property(nonatomic, strong, nullable, setter = setAppInviteOneLink:) NSString * appInviteOneLinkID
描述
从OneLink配置中设置您的OneLink ID。用于用户邀请以生成OneLink。
类型 | 名称 |
---|---|
NSString | appInviteOneLinkID |
appleAppID
属性声明
@property(nonatomic, strong) NSString * appleAppID
描述
使用此属性设置应用程序的Apple ID(取自iTunes Connect上的应用程序页面)
类型 | 名称 |
---|---|
NSString | appleAppID |
appsFlyerDevKey
属性声明
@property(nonatomic, strong) NSString * appsFlyerDevKey
描述
使用此属性设置您的AppsFlyer开发者密钥。
类型 | 名称 | 描述 |
---|---|---|
NSString | appsFlyerDevKey | 您的AppsFlyer开发者密钥。 |
currencyCode
属性声明
@property(nonatomic, strong, nullable) NSString *currencyCode
描述
在应用内购买事件的情况下,您可以设置用户购买时使用的货币代码。
根据ISO标准,货币代码是3个字母的代码。
用法示例
[[AppsFlyerLib shared] setCurrencyCode:@"USD"];
AppsFlyerLib.shared().currencyCode = "USD"
customData
设置
customData
before first launch will have the additional data included in installs, sessions, as well as in-app events.
属性声明
@property(nonatomic, strong, nullable, setter = setAdditionalData:) NSDictionary * customData
描述
Use to add custom data to events' payload. You will receive it in the raw-data reports.
类型 | 名称 |
---|---|
NSDictionary | customData |
customerUserID
属性声明
@property(nonatomic, strong, nullable) NSString * customerUserID
描述
如果您在应用中使用自己的用户ID,则可以将此属性设置为该ID。
使您能够将自己的独特ID与AppsFlyer的独特ID和其他设备的ID交叉引用
类型 | 名称 |
---|---|
NSString | customerUserID |
deepLinkDelegate
属性声明
@property(weak, nonatomic) id<AppsFlyerDeepLinkDelegate> deepLinkDelegate
描述
符合DeepLinkDelegate协议并实现其方法对象的委托属性。
类型 | 名称 |
---|---|
DeepLinkDelegate | deepLinkDelegate |
用法示例
AppsFlyerLib.shared().deepLinkDelegate = self
deepLinkTimeout
描述
Request timeout for Deferred Deeplinking.
Units in milliseconds.
属性声明
@property(nonatomic) NSUInteger deepLinkTimeout
类型 | 名称 |
---|---|
NSUInteger | deepLinkTimeout |
delegate
描述
AppsFlyer委托。请参阅AppsFlyerLibDelegate。
属性声明
@property (nonatomic, weak) id<AppsFlyerLibDelegate> delegate;
类型 | 名称 |
---|---|
AppsFlyerLibDelegate | delegate |
disableAdvertisingIdentifier
属性声明
@property (nonatomic) int disableAdvertisingIdentifier;
描述
If AdSupport.framework
isn't disabled, the SDK collects the Apple advertisingIdentifier
.
You can disable this behavior by setting the following property to YES
.
类型 | 名称 |
---|---|
NSString | advertisingIdentifier |
disableAppleAdsAttribution
属性声明
@property(nonatomic) BOOL disableAppleAdsAttribution
描述
Disables AdServices framework-based attribution for Apple Search Ads.
类型 | 名称 |
---|---|
bool | disableAppleAdsAttribution |
disableCollectASA
属性声明
@property(atomic) BOOL disableCollectASA;
描述
Disables the collection of data from the iAd Framework. This API has no effect in v6.12.3 and above, where the iAd Framework is no longer in use.
类型 | 名称 |
---|---|
bool | disableCollectASA |
disableIDFVCollection
属性声明
@property(nonatomic) BOOL disableIDFVCollection;
描述
To disable app vendor identifier (IDFV) collection, set disableIDFVCollection
to YES
.
类型 | 名称 |
---|---|
bool | disableIDFVCollection |
disableSKAdNetwork
属性声明
@property(nonatomic) BOOL disableSKAdNetwork
描述
类型 | 名称 |
---|---|
bool | disableSKAdNetwork |
facebookDeferredAppLink
属性声明
@property (nonatomic, nullable) int *facebookDeferredAppLink;
描述
手动设置Facebook延迟应用链接。
类型 | 名称 |
---|---|
NSString | advertisingIdentifier |
host (read-only)
属性声明
@property(nonatomic, strong, readonly) NSString *host
描述
This property accepts a string value representing the host name for all endpoints. To set the host, use setHost.
To use default SDK endpoint – set value to nil
.
类型 | 名称 |
---|---|
NSString | host |
hostPrefix (read-only)
属性声明
@property(nonatomic, strong, readonly) NSString *hostPrefix
描述
This property accepts a string value representing the prefix hostname for all endpoints. To set the host, use setHost.
类型 | 名称 |
---|---|
NSString | hostPrefix |
isDebug
属性声明
@property(nonatomic) BOOL isDebug;
描述
将SDK信息打印到控制台日志。在生产版本中应该禁用。
类型 | 名称 |
---|---|
bool | isDebug |
isStopped
属性声明
@property(atomic) BOOL isStopped;
SDK Restart
已设置
isStopped = true
and then setisStopped = false
No need to call
start()
描述
API to shut down all SDK activities. This will disable all requests from the SDK except for those related to fetching SKAd Network data from the server.
类型 | 名称 |
---|---|
bool | isStopped |
minTimeBetweenSessions
属性声明
@property(atomic) NSUInteger minTimeBetweenSessions;
描述
为互动间隔时间设置所需的自定义最小值。
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSUInteger | minTimeBetweenSessions | Sets the minimum time that must pass between two app launches to count as two separate sessions. If not set, the default minimum time between sessions is 5 seconds |
oneLinkCustomDomains
属性声明
@property(nonatomic, nullable) NSArray<NSString *> *oneLinkCustomDomains;
描述
适用于使用实名OneLinks的广告主。
类型 | 名称 |
---|---|
NSArray<NSString *> | oneLinkCustomDomains |
phoneNumber
属性声明
@property(nonatomic, nullable) NSString *phoneNumber
描述
类型 | 名称 |
---|---|
NSString | phoneNumber |
resolveDeepLinkURLs
属性声明
@property(nonatomic, nullable) NSArray<NSString *> *resolveDeepLinkURLs;
描述
类型 | 名称 |
---|---|
NSArray<NSString *> | resolveDeepLinkURLs |
用法示例
Some third-party services such as email service providers (ESPs) wrap links in emails with their own click recording domains. Some even allow you to set your own click recording domains. If OneLink is wrapped in such domains, it might limit its functionality.
To overcome this issue, use setResolveDeepLinkURLs
to get the OneLink from click domains that launch the app. Make sure to call this API before SDK initialization.
For example, you have three click domains that redirect to your OneLink which is https://mysubdomain.onelink.me/abCD. Use this API to get the OneLink that your click domains redirect to. This API method receives a list of domains that the SDK resolves.
[AppsFlyerLib shared].resolveDeepLinkURLs = @[@"example.com",@"click.example.com"];
AppsFlyerLib.shared().resolveDeepLinkURLs = ["example.com", "click.example.com"]
This allows you to use your click domain while preserving OneLink functionality. The click domains are responsible for launching the app. The API, in turn, gets the OneLink from these click domains, and then you can use the data from this OneLink to deep-link and customize user content.
sharingFilter
属性声明
@property(nonatomic, nullable) NSArray<NSString *> *sharingFilter;
描述
类型 | 名称 |
---|---|
NSArray<NSString *> | sharingFilter |
shouldCollectDeviceName
属性声明
@property(nonatomic) BOOL shouldCollectDeviceName;
描述
将此标志设置为YES,以收集当前设备名称(例如“我的 iPhone”)。
类型 | 名称 |
---|---|
bool | shouldCollectDeviceName |
useReceiptValidationSandbox
属性声明
@property (nonatomic) BOOL useReceiptValidationSandbox;
描述
应用内购买收据验证Apple环境(生产或沙盒)。
类型 | 名称 |
---|---|
bool | useReceiptValidationSandbox |
useUninstallSandbox
属性声明
@property (nonatomic) BOOL useUninstallSandbox;
描述
设置此标志以在Apple环境(生产或沙箱)上测试卸载。
类型 | 名称 |
---|---|
bool | useUninstallSandbox |
方法
addPushNotificationDeepLinkPath
方法签名
- (void)addPushNotificationDeepLinkPath:(NSArray<NSString *> *)deepLinkPath;
addPushNotificationDeepLinkPath(deepLinkPath: [String])
描述
添加密钥数组,用于组建密钥路径,用于解析推送通知有效载荷的深度链接。
输入参数
类型 | 名称 |
---|---|
NSArray<NSString *> | deepLinkPath |
返回
void
.
用法示例
Basic configuration:
[AppsFlyerLib shared] addPushNotificationDeepLinkPath:@[@"af_push_link"]]
AppsFlyerLib.shared().addPushNotificationDeepLinkPath(["af_push_link"])
Advanced configuration:
[AppsFlyerLib shared] addPushNotificationDeepLinkPath:@[@"deeply", @"nested", @"deep_link"]]
AppsFlyerLib.shared().addPushNotificationDeepLinkPath(["deeply", "nested", "deep_link"])
此调用方法可匹配以下调用方法:
{
"deeply": {
"nested": {
“deep_link”: “https://yourdeeplink2.onelink.me”
}
}
}
appendParametersToDeepLinkingURL
方法签名
(void)appendParametersToDeepLinkingURLWithString:(NSString *)containsString parameters:(NSDictionary<NSString *, NSString*> *)parameters;
appendParametersToDeeplinkURL(contains: String, parameters: [String : String])
描述
Matches URLs that contain contains
as a substring and appends query parameters to them. In case the URL does not match, parameters are not appended to it.
Call this method before calling
start
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | contains | 要在URL中检查的字符串。 |
NSDictionary | parameters | 通过验证后附加到深度链接URL上的参数。 |
返回
void
.
continue
方法签名
- (id)continueUserActivity:(id)userActivity
restorationHandler:
(void (^_Nullable)(int *_Nullable))restorationHandler;
AppsFlyerLib.shared().continue(userActivity: NSUserActivity?, restorationHandler: (([Any]?) -> Void)?)
描述
Allow AppsFlyer to handle restoration from an `NSUserActivity
. Use this method to handle Universal links.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSUserActivity | userActivity | The NSUserActivity that was passed to your app delegate |
void (^_Nullable)(int *_Nullable) | restorationHandler | 传递 nil |
返回
void
.
enableFacebookDeferderedApplinks
方法签名
- (void)enableFacebookDeferredApplinksWithClass:(Class _Nullable)facebookAppLinkUtilityClass;
enableFacebookDeferredApplinks(with:AnyClass?)
描述
启用Facebook延迟应用链接集合。
- 目标/客户端设备上需要Facebook SDK和Facebook应用程序。
- 必须在初始化AppsFlyer SDK之前调用此API才能正常运行
输入参数
类型 | 名称 | 描述 |
---|---|---|
FBSDKAppLinkUtility | facebookAppLinkUtilityClass |
返回
void
.
enableTCFDataCollection
方法签名
- (void)enableTCFDataCollection:(BOOL)flag;
func enableTCFDataCollection(_ flag: Bool)
描述
Enables the collection of Transparency and Consent Framework (TCF) data from NSUserDefaults
. The data was placed in UserDefaults
by the device's TCF v2.2 compatible Consent Management Platform (CMP).
输入参数
类型 | 名称 | 描述 |
---|---|---|
Bool | flag | A Boolean value to enable or disable the collection of TCF data. |
返回
void
.
getAppsFlyerUID
方法签名
- (NSString *)getAppsFlyerUID;
getAppsFlyerUID()
描述
Get AppsFlyer's unique device ID. The SDK generates an AppsFlyer unique device ID upon app installation. When the SDK is started, this ID is recorded as the ID of the first app install.
输入参数
此方法不接受输入参数。
返回
类型 | 描述 |
---|---|
NSString | AppsFlyer内部ID。 |
getSDKVersion
方法签名
- (NSString *)getSDKVersion;
getSDKVersion()
描述
获取SDK版本。
输入参数
此方法不接受输入参数。
返回
类型 | 描述 |
---|---|
NSString | AppsFlyer SDK版本。 |
handleOpen
方法签名
- (void)handleOpenUrl:(id)url options:(id)options;
AppsFlyerLib.shared().handleOpen(url: URL?, options: [AnyHashable : Any]?)
描述
Call this method from inside of your AppDelegate openURL
method.
This method handles URI-scheme for iOS 9 and above.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSURL | url | 传递给应用程序委托的URL。 |
AnyHashable | options | 传递给AppDelegate的选项字典。 |
返回
void
.
handlePushNotification
方法签名
- (void)handlePushNotification:(NSDictionary * _Nullable)pushPayload;
AppsFlyerLib.shared().handlePushNotification(pushPayload: [AnyHashable : Any]?)
描述
启用AppsFlyer来处理推送通知。
输入参数
类型 | 名称 | 描述 |
---|---|---|
AnyHashable | pushPayload | The userInfo from received remote notification. Unless addPushNotificationDeepLinkPath is used, the data must be under the @“af” key. |
返回
void
.
logAdRevenue
Added in v6.15.0
方法签名
-(void)logAdRevenue:(AFAdRevenueData *)adRevenueData additionalParameters:(NSDictionary * **_Nullable**)additionalParameters;
描述
The method sends an ad revenue event to AppsFlyer. See more information in Ad revenue.
输入参数
名称 | 类型 | 描述 |
---|---|---|
adRevenueData | AFAdRevenueData* | An object that encapsulates all the mandatory parameters of the adRevenue event. The object is passed to the logAdRevenue method. |
additionalParameters | NSDictionary * _Nullable | An optional dictionary containing additional parameters to log with the adRevenue event. |
返回
void
.
AFAdRevenueData
An object that encapsulates all mandatory adRevenue
data received from the mediation network.
Definition
AFAdRevenueData {
(NSString * **_Nonnull**)monetizationNetwork
(AppsFlyerAdRevenueMediationNetworkType)mediationNetwork
(NSString * **_Nonnull**)currencyIso4217Code
(NSNumber * **_Nonnull**)eventRevenue
}
AFAdRevenueData parameters
名称 | 类型 | 描述 |
---|---|---|
monetizationNetwork | 文字 | The monetization network name. |
mediationNetwork | AppsFlyerAdRevenueMediationNetworkType | The mediation network enum. |
currencyIso4217Code | 文字 | The ad revenue event currency is a String validated against currencyIso4217Code |
eventRevenue | Double | The ad revenue event amount. |
AppsFlyerAdRevenueMediationNetworkType
名称 | 类型 | Comments |
---|---|---|
ironsource | 文字 | |
applovinmax | 文字 | |
googleadmob | 文字 | |
fyber | 文字 | |
appodeal | 文字 | |
admost | 文字 | |
topon | 文字 | |
tradplus | 文字 | |
yandex | 文字 | |
chartboost | 文字 | |
unity | 文字 | |
customMediation | 文字 | The mediation solution is not on the list of supported mediation partners. |
directMonetizationNetwork | 文字 | The app integrates directly with monetization networks without mediation. |
logEvent
方法签名
- (void)logEvent:(NSString *)eventName withValues:(NSDictionary * _Nullable)values;
logEvent(eventName: String, withValues: [AnyHashable : Any]?)
描述
使用此方法记录带有事件参数的事件。
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | eventName | 包含可由预定义常量提供的事件名称 |
AnyHashable | withValues | 后端处理值的字典 |
返回
void
.
logEvent
方法签名
- (void)logEventWithEventName:(NSString *)eventName
eventValues:(NSDictionary<NSString * , id> * _Nullable)eventValues
completionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler;
logEvent(eventName: String, withValues: [AnyHashable : Any]?, completionHandler:(([String : Any]?, Error?) -> Void)?)
描述
使用此方法记录带有事件参数的事件,并传递一个完成处理程序来处理事件提交成功和失败。
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | eventName | 包含可由预定义常量提供的事件名称 |
AnyHashable | withValues | 后端处理值的字典 |
(^ _Nullable)(NSDictionary<NSString _, id> _ _Nullable dictionary, NSError * _Nullable error)) | completionHandler |
返回
void
.
logLocation
方法签名
- (void)logLocation:(double)longitude latitude:(double)latitude;
logLocation(longitude: Double, latitude: Double)
描述
记录地理围栏的位置。与下面的代码执行相同的操作。
输入参数
类型 | 名称 | 描述 |
---|---|---|
Double | longitude | 位置经度 |
Double | latitude | 位置纬度 |
返回
void
.
performOnAppAttribution
方法签名
- (void)performOnAppAttributionWithURL:(NSURL * _Nullable)URL;
performOnAppAttribution(with:URL?)
描述
Used to manually trigger onAppOpenAttribution
delegate.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSURL | URL | 解析为-[AppsFlyerLibDelegate onAppOpenAttribution:]的参数 |
返回
void
.
registerUninstall
方法签名
- (void)registerUninstall:(NSData * _Nullable)deviceToken;
registerUninstall(deviceToken: Data?)
描述
注册卸载 - 您应该注册远程通知并为AppsFlyer提供推送设备令牌。
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSData | deviceToken | The deviceToken is from didRegisterForRemoteNotificationsWithDeviceToken . |
返回
void
.
setConsentData
方法签名
.setConsentData(afConsent: AppsFlyerConsent)
- (void)setConsentData:(AppsFlyerConsent) afConsent
描述
Transfers consent data to the SDK.
输入参数
类型 | 名称 | 描述 |
---|---|---|
AppsFlyerConsent | afConsent | An object containing user consent data |
setCurrentDeviceLanguage
方法签名
- (void)setCurrentDeviceLanguage:(NSString *)currentDeviceLanguage
描述
Use this method to set the device language in the SDK and pass it to AppsFlyer.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | currentDeviceLanguage | Current device language. |
用法示例
NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0]
[[AppsFlyerLib shared] setCurrentDeviceLanguage: @language];
let language = NSLocale.current.languageCode
AppsFlyerLib.shared().currentDeviceLanguage = language
setHost
方法签名
(void)setHost:(NSString *)host withHostPrefix:(NSString *)hostPrefix;
setHost(host: String, withHostPrefix: String)
描述
此函数为所有端点设置主机名称和前缀主机名称。
Note: Starting with SDK V6.11, if the host value is empty or null, the API call will be ignored.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | host | 主机名称。 |
NSString | withHostPrefix | Required. host prefix. |
返回
void
.
用法示例
[[AppsFlyerLib shared] setHost:@"example.com" withHostPrefix:@"my_host_prefix"];
AppsFlyerLib.shared().setHost("example.com", withHostPrefix: "my_host_prefix")
setPartnerData
方法签名
- (void)setPartnerDataWithPartnerId:(NSString * _Nullable)partnerId partnerInfo:(NSDictionary<NSString *, id> * _Nullable)partnerInfo;
setPartnerData(partnerId: String?, partnerInfo: [String : Any]?)
描述
允许为合作伙伴的对接目的发送自定义数据。
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | partnerId | ID of the partner (usually has _int suffix) |
NSDictionary<NSString _, id> _ _Nullable | partnerInfo | 客户数据,取决于与特定合作伙伴的对接性质 |
返回
void
.
用法示例
NSDictionary *partnerInfo = @{
@"puid": @"123456789",
};
[[AppsFlyerLib shared] setPartnerDataWithPartnerId: @"test_int" partnerInfo:partnerInfo];
let partnerInfo = [
"puid":"123456789",
]
AppsFlyerLib.shared().setPartnerData(partnerId:"test_int", partnerInfo:partnerInfo)
setSharingFilterForPartners
Added in V6.4
方法签名
- (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
This function replaces the deprecated setSharingFilterForAllPartners
描述
Lets you configure which partners should the SDK exclude from data-sharing.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSArray<NSString _> _ _Nullable | sharingFilter | One or more partner identifiers you wish to exclude. Must include letters/digits and underscores only. Maximum partner ID length: 45 |
To find out the required partner IDs:
- Run the Get active integrations API for a list of all active integrations
- Use the
media_source_name
values from the API response as input values to the methodpartners
array.
Exceptions:
- For Apple Search Ads use
Apple Search Ads
(and notiossearchads_int
). - For Twitter, use
twitter
(and nottwitter_int
)
用法示例
[[AppsFlyerLib shared] setSharingFilterForPartners:@[@"examplePartner1_int"]]; // 1 partner
[[AppsFlyerLib shared] setSharingFilterForPartners:@[@"examplePartner1_int", @"examplePartner2_int"]]; // multiple partners
[[AppsFlyerLib shared] setSharingFilterForPartners:@[@"all"]]; // All partners
[[AppsFlyerLib shared] setSharingFilterForPartners:nil]; // Reset list (default)
AppsFlyerLib.shared().setSharingFilterForPartners(["examplePartner1_int"]) // 1 partner
AppsFlyerLib.shared().setSharingFilterForPartners(["examplePartner2_int", "examplePartner1_int"]) // multiple partners
AppsFlyerLib.shared().setSharingFilterForPartners(["all"]) // All partners
AppsFlyerLib.shared().setSharingFilterForPartners(nil) // Reset list (default)
setSharingFilterForAllPartners
Deprecated in V6.4
方法签名
- (void)setSharingFilterForAllPartners;
setSharingFilterForAllPartners()
This function is deprecated and has been replaced by setSharingFilterForPartners
描述
Block an event from being shared with integrated partners.
输入参数
此方法不接受输入参数。
返回
void
setUserEmails
方法签名
- (void)setUserEmails:(NSArray<NSString *> * _Nullable)userEmails withCryptType:(EmailCryptType)type;
setUserEmails(userEmails: [String]?, with: EmailCryptType)
描述
Use this to set the user email(s).
Note: MD-5
and SHA-1
encryption types are deprecated starting with SDK V6.9.0. Currently, only SHA-256
and NONE
are supported.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSArray<NSString *> | userEmails | 电子邮件数组。 |
EmailCryptType | type | 加密类型。 |
返回
void
.
shared
方法签名
(AppsFlyerLib *)shared;
描述
Gets the singleton instance of the AppsFlyerLib
class, creating it if necessary.
用法示例
AppsFlyerLib.shared()
start
方法签名
- (void)start;
(void) start()
描述
启动SDK。
输入参数
此方法不接受输入参数。
返回
void
.
start
方法签名
- (void)startWithCompletionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler;
start(completionHandler: (([String : Any]?, Error?) -> Void)?)
描述
使用完成处理程序启动 SDK。
输入参数
类型 | 名称 | 描述 |
---|---|---|
void (^ _Nullable)(NSDictionary<NSString _, id> _ _Nullable dictionary, NSError * _Nullable error) | completionHandler |
返回
void
.
validateAndLogInAppPurchase
(Supported from SDK v.6.14.1)
方法签名
typedef void (^AFSDKValidateAndLogCompletion)(AFSDKValidateAndLogResult * _Nullable result);
- (void)validateAndLogInAppPurchase:(AFSDKPurchaseDetails *)details
extraEventValues:(NSDictionary * _Nullable)extraEventValues
completionHandler:(AFSDKValidateAndLogCompletion)completionHandler NS_AVAILABLE(10_7, 7_0);
描述
The method validates a purchase event with the store and if the validation is successful, the SDK sends an af_purchase
event to AppsFlyer.
See detailed instructions in Validate and log in-app purchase.
输入参数
名称 | 类型 | 描述 |
---|---|---|
details * | 'AFSDKPurchaseDetails'* | An object that encapsulates all data related to the purchase provided to the validateAndLogInAppPurchase method. |
extraEventValues | NSDictionary * _Nullable | An optional dictionary containing additional parameters to log with the purchase event. |
completionHandler * | AFSDKValidateAndLogCompletion | A completion handler block that is called with the result of the purchase validation and logging. |
返回
void
.
AFSDKPurchaseDetails
An object that encapsulates all data related to the purchase provided to the validateAndLogInAppPurchase
方法。
AFSDKPurchaseDetails parameters
名称 | 类型 | 描述 |
---|---|---|
productId | 文字 | The product identifier for the purchase. |
price | 文字 | The price of the product. |
currency | 文字 | The currency used for the billing operation. |
transactionId | 文字 | A specific identifier for the transaction. |
validateAndLogInAppPurchase (LEGACY)
(Supported until SDK v.6.14.0)
方法签名
- (void)validateAndLogInAppPurchase:(id)productIdentifier
price:(id)price
currency:(id)currency
transactionId:(id)transactionId
additionalParameters:(id)params
success:(void (^_Nullable)(int *))successBlock
failure:
(void (^_Nullable)(int *_Nullable,
id _Nullable))failedBlock;
validateAndLog(inAppPurchase: String?, price: String?, currency: String?, transactionId: String?, additionalParameters: [AnyHashable : Any]?, success: ([AnyHashable : Any]) -> Void)?, failure: ((Error?, Any?) -> Void)?)
描述
To log and validate in-app purchases you can call this method from the [completeTransaction
] method in your SKPaymentTransactionObserver
.
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSString | productIdentifier | inAppPurchase 在Swift中。 |
NSString | price | |
NSString | currency | |
NSString | transactionId | |
NSDictionary | additionalParameters | |
void (^_Nullable)(int *))successBlock | successBlock | 记录和验证成功时的完成处理程序。 |
void (^_Nullable)(int *_Nullable, id _Nullable)) | failedBlock | 记录和验证失败时的完成处理程序。 |
返回
void
.
waitForATTUserAuthorization
方法签名
- (void)waitForATTUserAuthorizationWithTimeoutInterval:(id)timeoutInterval;
waitForATTUserAuthorization(timeoutInterval:)
描述
等待请求用户授权访问应用程序的相关数据
输入参数
类型 | 名称 | 描述 |
---|---|---|
NSInteger | timeoutInterval |
用法示例
if (@available(iOS 14, *)) {
[[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:60];
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status){
}];
}
if #available(iOS 14, *) {
AppsFlyerLib.shared().waitForATTUserAuthorization(withTimeoutInterval: 60)
ATTrackingManager.requestTrackingAuthorization { (status) in
}
}
返回
void
.
已更新 about 1 month ago