AppsFlyerLib.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. //
  2. // AppsFlyerLib.h
  3. // AppsFlyerLib
  4. //
  5. // AppsFlyer iOS SDK 6.14.5.189 (189)
  6. // Copyright (c) 2012-2023 AppsFlyer Ltd. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AppsFlyerLib/AppsFlyerCrossPromotionHelper.h>
  10. #import <AppsFlyerLib/AppsFlyerShareInviteHelper.h>
  11. #import <AppsFlyerLib/AppsFlyerDeepLinkResult.h>
  12. #import <AppsFlyerLib/AppsFlyerDeepLink.h>
  13. #import <AppsFlyerLib/AppsFlyerConsent.h>
  14. #import <AppsFlyerLib/AFSDKPurchaseDetails.h>
  15. #import <AppsFlyerLib/AFSDKValidateAndLogResult.h>
  16. NS_ASSUME_NONNULL_BEGIN
  17. // In app event names constants
  18. #define AFEventLevelAchieved @"af_level_achieved"
  19. #define AFEventAddPaymentInfo @"af_add_payment_info"
  20. #define AFEventAddToCart @"af_add_to_cart"
  21. #define AFEventAddToWishlist @"af_add_to_wishlist"
  22. #define AFEventCompleteRegistration @"af_complete_registration"
  23. #define AFEventTutorial_completion @"af_tutorial_completion"
  24. #define AFEventInitiatedCheckout @"af_initiated_checkout"
  25. #define AFEventPurchase @"af_purchase"
  26. #define AFEventRate @"af_rate"
  27. #define AFEventSearch @"af_search"
  28. #define AFEventSpentCredits @"af_spent_credits"
  29. #define AFEventAchievementUnlocked @"af_achievement_unlocked"
  30. #define AFEventContentView @"af_content_view"
  31. #define AFEventListView @"af_list_view"
  32. #define AFEventTravelBooking @"af_travel_booking"
  33. #define AFEventShare @"af_share"
  34. #define AFEventInvite @"af_invite"
  35. #define AFEventLogin @"af_login"
  36. #define AFEventReEngage @"af_re_engage"
  37. #define AFEventUpdate @"af_update"
  38. #define AFEventOpenedFromPushNotification @"af_opened_from_push_notification"
  39. #define AFEventLocation @"af_location_coordinates"
  40. #define AFEventCustomerSegment @"af_customer_segment"
  41. #define AFEventSubscribe @"af_subscribe"
  42. #define AFEventStartTrial @"af_start_trial"
  43. #define AFEventAdClick @"af_ad_click"
  44. #define AFEventAdView @"af_ad_view"
  45. // In app event parameter names
  46. #define AFEventParamContent @"af_content"
  47. #define AFEventParamAchievementId @"af_achievement_id"
  48. #define AFEventParamLevel @"af_level"
  49. #define AFEventParamScore @"af_score"
  50. #define AFEventParamSuccess @"af_success"
  51. #define AFEventParamPrice @"af_price"
  52. #define AFEventParamContentType @"af_content_type"
  53. #define AFEventParamContentId @"af_content_id"
  54. #define AFEventParamContentList @"af_content_list"
  55. #define AFEventParamCurrency @"af_currency"
  56. #define AFEventParamQuantity @"af_quantity"
  57. #define AFEventParamRegistrationMethod @"af_registration_method"
  58. #define AFEventParamPaymentInfoAvailable @"af_payment_info_available"
  59. #define AFEventParamMaxRatingValue @"af_max_rating_value"
  60. #define AFEventParamRatingValue @"af_rating_value"
  61. #define AFEventParamSearchString @"af_search_string"
  62. #define AFEventParamDateA @"af_date_a"
  63. #define AFEventParamDateB @"af_date_b"
  64. #define AFEventParamDestinationA @"af_destination_a"
  65. #define AFEventParamDestinationB @"af_destination_b"
  66. #define AFEventParamDescription @"af_description"
  67. #define AFEventParamClass @"af_class"
  68. #define AFEventParamEventStart @"af_event_start"
  69. #define AFEventParamEventEnd @"af_event_end"
  70. #define AFEventParamLat @"af_lat"
  71. #define AFEventParamLong @"af_long"
  72. #define AFEventParamCustomerUserId @"af_customer_user_id"
  73. #define AFEventParamValidated @"af_validated"
  74. #define AFEventParamRevenue @"af_revenue"
  75. #define AFEventProjectedParamRevenue @"af_projected_revenue"
  76. #define AFEventParamReceiptId @"af_receipt_id"
  77. #define AFEventParamTutorialId @"af_tutorial_id"
  78. #define AFEventParamVirtualCurrencyName @"af_virtual_currency_name"
  79. #define AFEventParamDeepLink @"af_deep_link"
  80. #define AFEventParamOldVersion @"af_old_version"
  81. #define AFEventParamNewVersion @"af_new_version"
  82. #define AFEventParamReviewText @"af_review_text"
  83. #define AFEventParamCouponCode @"af_coupon_code"
  84. #define AFEventParamOrderId @"af_order_id"
  85. #define AFEventParam1 @"af_param_1"
  86. #define AFEventParam2 @"af_param_2"
  87. #define AFEventParam3 @"af_param_3"
  88. #define AFEventParam4 @"af_param_4"
  89. #define AFEventParam5 @"af_param_5"
  90. #define AFEventParam6 @"af_param_6"
  91. #define AFEventParam7 @"af_param_7"
  92. #define AFEventParam8 @"af_param_8"
  93. #define AFEventParam9 @"af_param_9"
  94. #define AFEventParam10 @"af_param_10"
  95. #define AFEventParamTouch @"af_touch_obj"
  96. #define AFEventParamDepartingDepartureDate @"af_departing_departure_date"
  97. #define AFEventParamReturningDepartureDate @"af_returning_departure_date"
  98. #define AFEventParamDestinationList @"af_destination_list" //array of string
  99. #define AFEventParamCity @"af_city"
  100. #define AFEventParamRegion @"af_region"
  101. #define AFEventParamCountry @"af_country"
  102. #define AFEventParamDepartingArrivalDate @"af_departing_arrival_date"
  103. #define AFEventParamReturningArrivalDate @"af_returning_arrival_date"
  104. #define AFEventParamSuggestedDestinations @"af_suggested_destinations" //array of string
  105. #define AFEventParamTravelStart @"af_travel_start"
  106. #define AFEventParamTravelEnd @"af_travel_end"
  107. #define AFEventParamNumAdults @"af_num_adults"
  108. #define AFEventParamNumChildren @"af_num_children"
  109. #define AFEventParamNumInfants @"af_num_infants"
  110. #define AFEventParamSuggestedHotels @"af_suggested_hotels" //array of string
  111. #define AFEventParamUserScore @"af_user_score"
  112. #define AFEventParamHotelScore @"af_hotel_score"
  113. #define AFEventParamPurchaseCurrency @"af_purchase_currency"
  114. #define AFEventParamPreferredStarRatings @"af_preferred_star_ratings" //array of int (basically a tuple (min,max) but we'll use array of int and instruct the developer to use two values)
  115. #define AFEventParamPreferredPriceRange @"af_preferred_price_range" //array of int (basically a tuple (min,max) but we'll use array of int and instruct the developer to use two values)
  116. #define AFEventParamPreferredNeighborhoods @"af_preferred_neighborhoods" //array of string
  117. #define AFEventParamPreferredNumStops @"af_preferred_num_stops"
  118. #define AFEventParamAdRevenueAdType @"af_adrev_ad_type"
  119. #define AFEventParamAdRevenueNetworkName @"af_adrev_network_name"
  120. #define AFEventParamAdRevenuePlacementId @"af_adrev_placement_id"
  121. #define AFEventParamAdRevenueAdSize @"af_adrev_ad_size"
  122. #define AFEventParamAdRevenueMediatedNetworkName @"af_adrev_mediated_network_name"
  123. /// Mail hashing type
  124. typedef enum {
  125. /// None
  126. EmailCryptTypeNone = 0,
  127. /// SHA256
  128. EmailCryptTypeSHA256 = 3
  129. } EmailCryptType;
  130. typedef NS_CLOSED_ENUM(NSInteger, AFSDKPlugin) {
  131. AFSDKPluginIOSNative,
  132. AFSDKPluginUnity,
  133. AFSDKPluginFlutter,
  134. AFSDKPluginReactNative,
  135. AFSDKPluginAdobeAir,
  136. AFSDKPluginAdobeMobile,
  137. AFSDKPluginCocos2dx,
  138. AFSDKPluginCordova,
  139. AFSDKPluginMparticle,
  140. AFSDKPluginNativeScript,
  141. AFSDKPluginExpo,
  142. AFSDKPluginUnreal,
  143. AFSDKPluginXamarin,
  144. AFSDKPluginCapacitor,
  145. AFSDKPluginSegment,
  146. AFSDKPluginAdobeSwiftAEP
  147. } NS_SWIFT_NAME(Plugin);
  148. NS_SWIFT_NAME(DeepLinkDelegate)
  149. @protocol AppsFlyerDeepLinkDelegate <NSObject>
  150. @optional
  151. - (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *_Nonnull)result;
  152. @end
  153. /**
  154. Conform and subscribe to this protocol to allow getting data about conversion and
  155. install attribution
  156. */
  157. @protocol AppsFlyerLibDelegate <NSObject>
  158. /**
  159. `conversionInfo` contains information about install.
  160. Organic/non-organic, etc.
  161. @param conversionInfo May contain <code>null</code> values for some keys. Please handle this case.
  162. */
  163. - (void)onConversionDataSuccess:(NSDictionary *)conversionInfo;
  164. /**
  165. Any errors that occurred during the conversion request.
  166. */
  167. - (void)onConversionDataFail:(NSError *)error;
  168. @optional
  169. /**
  170. `attributionData` contains information about OneLink, deeplink.
  171. */
  172. - (void)onAppOpenAttribution:(NSDictionary *)attributionData;
  173. /**
  174. Any errors that occurred during the attribution request.
  175. */
  176. - (void)onAppOpenAttributionFailure:(NSError *)error;
  177. /**
  178. @abstract Sets the HTTP header fields of the ESP resolving to the given
  179. dictionary.
  180. @discussion This method replaces all header fields that may have
  181. existed before this method ESP resolving call.
  182. To keep default SDK behavior - return nil;
  183. */
  184. - (NSDictionary <NSString *, NSString *> * _Nullable)allHTTPHeaderFieldsForResolveDeepLinkURL:(NSURL *)URL;
  185. @end
  186. /**
  187. You can log installs, app updates, sessions and additional in-app events
  188. (including in-app purchases, game levels, etc.)
  189. to evaluate ROI and user engagement.
  190. The iOS SDK is compatible with all iOS/tvOS devices with iOS version 7 and above.
  191. @see [SDK Integration Validator](https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS)
  192. for more information.
  193. */
  194. @interface AppsFlyerLib : NSObject
  195. /**
  196. Gets the singleton instance of the AppsFlyerLib class, creating it if
  197. necessary.
  198. @return The singleton instance of AppsFlyerLib.
  199. */
  200. + (AppsFlyerLib *)shared;
  201. - (void)setUpInteroperabilityObject:(id)object;
  202. /**
  203. In case you use your own user ID in your app, you can set this property to that ID.
  204. Enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs
  205. */
  206. @property(nonatomic, strong, nullable) NSString * customerUserID;
  207. /**
  208. In case you use custom data and you want to receive it in the raw reports.
  209. @see [Setting additional custom data](https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS#setting-additional-custom-data) for more information.
  210. */
  211. @property(nonatomic, strong, nullable, setter = setAdditionalData:) NSDictionary * customData;
  212. /**
  213. Use this property to set your AppsFlyer's dev key
  214. */
  215. @property(nonatomic, strong) NSString * appsFlyerDevKey;
  216. /**
  217. Use this property to set your app's Apple ID(taken from the app's page on iTunes Connect)
  218. */
  219. @property(nonatomic, strong) NSString * appleAppID;
  220. #ifndef AFSDK_NO_IDFA
  221. /**
  222. AppsFlyer SDK collect Apple's `advertisingIdentifier` if the `AdSupport.framework` included in the SDK.
  223. You can disable this behavior by setting the following property to YES
  224. */
  225. @property(nonatomic) BOOL disableAdvertisingIdentifier;
  226. @property(nonatomic, strong, readonly) NSString *advertisingIdentifier;
  227. /**
  228. Waits for request user authorization to access app-related data
  229. */
  230. - (void)waitForATTUserAuthorizationWithTimeoutInterval:(NSTimeInterval)timeoutInterval
  231. NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
  232. #endif
  233. @property(nonatomic) BOOL disableSKAdNetwork;
  234. /**
  235. In case of in app purchase events, you can set the currency code your user has purchased with.
  236. The currency code is a 3 letter code according to ISO standards
  237. Objective-C:
  238. <pre>
  239. [[AppsFlyerLib shared] setCurrencyCode:@"USD"];
  240. </pre>
  241. Swift:
  242. <pre>
  243. AppsFlyerLib.shared().currencyCode = "USD"
  244. </pre>
  245. */
  246. @property(nonatomic, strong, nullable) NSString *currencyCode;
  247. /**
  248. Prints SDK messages to the console log. This property should only be used in `DEBUG` mode.
  249. The default value is `NO`
  250. */
  251. @property(nonatomic) BOOL isDebug;
  252. /**
  253. Set this flag to `YES`, to collect the current device name(e.g. "My iPhone"). Default value is `NO`
  254. */
  255. @property(nonatomic) BOOL shouldCollectDeviceName;
  256. /**
  257. Set your `OneLink ID` from OneLink configuration. Used in User Invites to generate a OneLink.
  258. */
  259. @property(nonatomic, strong, nullable, setter = setAppInviteOneLink:) NSString * appInviteOneLinkID;
  260. /**
  261. Opt-out logging for specific user
  262. */
  263. @property(atomic) BOOL anonymizeUser;
  264. /**
  265. Opt-out for Apple Search Ads attributions
  266. */
  267. @property(atomic) BOOL disableCollectASA;
  268. /**
  269. Disable Apple Ads Attribution API +[AAAtribution attributionTokenWithError:]
  270. */
  271. @property(nonatomic) BOOL disableAppleAdsAttribution;
  272. /**
  273. AppsFlyer delegate. See `AppsFlyerLibDelegate`
  274. */
  275. @property(weak, nonatomic) id<AppsFlyerLibDelegate> delegate;
  276. @property(weak, nonatomic) id<AppsFlyerDeepLinkDelegate> deepLinkDelegate;
  277. /**
  278. In app purchase receipt validation Apple environment(production or sandbox). The default value is NO
  279. */
  280. @property(nonatomic) BOOL useReceiptValidationSandbox;
  281. /**
  282. Set this flag to test uninstall on Apple environment(production or sandbox). The default value is NO
  283. */
  284. @property(nonatomic) BOOL useUninstallSandbox;
  285. /**
  286. For advertisers who wrap OneLink within another Universal Link.
  287. An advertiser will be able to deeplink from a OneLink wrapped within another Universal Link and also log this retargeting conversion.
  288. Objective-C:
  289. <pre>
  290. [[AppsFlyerLib shared] setResolveDeepLinkURLs:@[@"domain.com", @"subdomain.domain.com"]];
  291. </pre>
  292. */
  293. @property(nonatomic, nullable, copy) NSArray<NSString *> *resolveDeepLinkURLs;
  294. /**
  295. For advertisers who use vanity OneLinks.
  296. Objective-C:
  297. <pre>
  298. [[AppsFlyerLib shared] oneLinkCustomDomains:@[@"domain.com", @"subdomain.domain.com"]];
  299. </pre>
  300. */
  301. @property(nonatomic, nullable, copy) NSArray<NSString *> *oneLinkCustomDomains;
  302. /*
  303. * Set phone number for each `start` event. `phoneNumber` will be sent as SHA256 string
  304. */
  305. @property(nonatomic, nullable, copy) NSString *phoneNumber;
  306. - (NSString *)phoneNumber UNAVAILABLE_ATTRIBUTE;
  307. /**
  308. To disable app's vendor identifier(IDFV), set disableIDFVCollection to true
  309. */
  310. @property(nonatomic) BOOL disableIDFVCollection;
  311. /**
  312. Set the language of the device. The data will be displayed in Raw Data Reports
  313. Objective-C:
  314. <pre>
  315. [[AppsFlyerLib shared] setCurrentDeviceLanguage:@"EN"]
  316. </pre>
  317. Swift:
  318. <pre>
  319. AppsFlyerLib.shared().currentDeviceLanguage("EN")
  320. </pre>
  321. */
  322. @property(nonatomic, nullable, copy) NSString *currentDeviceLanguage;
  323. /**
  324. Internal API. Please don't use.
  325. */
  326. - (void)setPluginInfoWith:(AFSDKPlugin)plugin
  327. pluginVersion:(NSString *)version
  328. additionalParams:(NSDictionary * _Nullable)additionalParams
  329. NS_SWIFT_NAME(setPluginInfo(plugin:version:additionalParams:));
  330. /**
  331. Enable the collection of Facebook Deferred AppLinks
  332. Requires Facebook SDK and Facebook app on target/client device.
  333. This API must be invoked prior to initializing the AppsFlyer SDK in order to function properly.
  334. Objective-C:
  335. <pre>
  336. [[AppsFlyerLib shared] enableFacebookDeferredApplinksWithClass:[FBSDKAppLinkUtility class]]
  337. </pre>
  338. Swift:
  339. <pre>
  340. AppsFlyerLib.shared().enableFacebookDeferredApplinks(with: FBSDKAppLinkUtility.self)
  341. </pre>
  342. @param facebookAppLinkUtilityClass requeries method call `[FBSDKAppLinkUtility class]` as param.
  343. */
  344. - (void)enableFacebookDeferredApplinksWithClass:(Class _Nullable)facebookAppLinkUtilityClass;
  345. /**
  346. Use this to send the user's emails
  347. @param userEmails The list of strings that hold mails
  348. @param type Hash algoritm
  349. */
  350. - (void)setUserEmails:(NSArray<NSString *> * _Nullable)userEmails withCryptType:(EmailCryptType)type;
  351. /**
  352. Start SDK session
  353. Add the following method at the `applicationDidBecomeActive` in AppDelegate class
  354. */
  355. - (void)start;
  356. - (void)startWithCompletionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler;
  357. /**
  358. Use this method to log an events with multiple values. See AppsFlyer's documentation for details.
  359. Objective-C:
  360. <pre>
  361. [[AppsFlyerLib shared] logEvent:AFEventPurchase
  362. withValues: @{AFEventParamRevenue : @200,
  363. AFEventParamCurrency : @"USD",
  364. AFEventParamQuantity : @2,
  365. AFEventParamContentId: @"092",
  366. AFEventParamReceiptId: @"9277"}];
  367. </pre>
  368. Swift:
  369. <pre>
  370. AppsFlyerLib.shared().logEvent(AFEventPurchase,
  371. withValues: [AFEventParamRevenue : "1200",
  372. AFEventParamContent : "shoes",
  373. AFEventParamContentId: "123"])
  374. </pre>
  375. @param eventName Contains name of event that could be provided from predefined constants in `AppsFlyerLib.h`
  376. @param values Contains dictionary of values for handling by backend
  377. */
  378. - (void)logEvent:(NSString *)eventName withValues:(NSDictionary * _Nullable)values;
  379. - (void)logEventWithEventName:(NSString *)eventName
  380. eventValues:(NSDictionary<NSString * , id> * _Nullable)eventValues
  381. completionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler
  382. NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
  383. /**
  384. To log and validate in app purchases you can call this method from the completeTransaction: method on
  385. your `SKPaymentTransactionObserver`.
  386. @param productIdentifier The product identifier
  387. @param price The product price
  388. @param currency The product currency
  389. @param transactionId The purchase transaction Id
  390. @param params The additional param, which you want to receive it in the raw reports
  391. @param successBlock The success callback
  392. @param failedBlock The failure callback
  393. */
  394. - (void)validateAndLogInAppPurchase:(NSString * _Nullable)productIdentifier
  395. price:(NSString * _Nullable)price
  396. currency:(NSString * _Nullable)currency
  397. transactionId:(NSString * _Nullable)transactionId
  398. additionalParameters:(NSDictionary * _Nullable)params
  399. success:(void (^ _Nullable)(NSDictionary * response))successBlock
  400. failure:(void (^ _Nullable)(NSError * _Nullable error, id _Nullable reponse))failedBlock NS_AVAILABLE(10_7, 7_0);
  401. typedef void (^AFSDKValidateAndLogCompletion)(AFSDKValidateAndLogResult * _Nullable result);
  402. /**
  403. To log and validate in app purchases you can call this method from the completeTransaction: method on
  404. your `SKPaymentTransactionObserver`.
  405. @param details The product details
  406. @param extraEventValues The additional param, which you want to receive it in the raw reports
  407. @param completionHandler The callback
  408. */
  409. - (void)validateAndLogInAppPurchase:(AFSDKPurchaseDetails *)details
  410. extraEventValues:(NSDictionary * _Nullable)extraEventValues
  411. completionHandler:(AFSDKValidateAndLogCompletion)completionHandler NS_AVAILABLE(10_7, 7_0);
  412. /**
  413. To log location for geo-fencing. Does the same as code below.
  414. <pre>
  415. AppsFlyerLib.shared().logEvent(AFEventLocation, withValues: [AFEventParamLong:longitude, AFEventParamLat:latitude])
  416. </pre>
  417. @param longitude The location longitude
  418. @param latitude The location latitude
  419. */
  420. - (void)logLocation:(double)longitude latitude:(double)latitude NS_SWIFT_NAME(logLocation(longitude:latitude:));
  421. /**
  422. This method returns AppsFlyer's internal id(unique for your app)
  423. @return Internal AppsFlyer Id
  424. */
  425. - (NSString *)getAppsFlyerUID;
  426. /**
  427. In case you want to log deep linking. Does the same as `-handleOpenURL:sourceApplication:withAnnotation`.
  428. @warning Preferred to use `-handleOpenURL:sourceApplication:withAnnotation`.
  429. @param url The URL that was passed to your AppDelegate.
  430. @param sourceApplication The sourceApplication that passed to your AppDelegate.
  431. */
  432. - (void)handleOpenURL:(NSURL * _Nullable)url sourceApplication:(NSString * _Nullable)sourceApplication API_UNAVAILABLE(macos);
  433. /**
  434. In case you want to log deep linking.
  435. Call this method from inside your AppDelegate `-application:openURL:sourceApplication:annotation:`
  436. @param url The URL that was passed to your AppDelegate.
  437. @param sourceApplication The sourceApplication that passed to your AppDelegate.
  438. @param annotation The annotation that passed to your app delegate.
  439. */
  440. - (void)handleOpenURL:(NSURL * _Nullable)url
  441. sourceApplication:(NSString * _Nullable)sourceApplication
  442. withAnnotation:(id _Nullable)annotation API_UNAVAILABLE(macos);
  443. /**
  444. Call this method from inside of your AppDelegate `-application:openURL:options:` method.
  445. This method is functionally the same as calling the AppsFlyer method
  446. `-handleOpenURL:sourceApplication:withAnnotation`.
  447. @param url The URL that was passed to your app delegate
  448. @param options The options dictionary that was passed to your AppDelegate.
  449. */
  450. - (void)handleOpenUrl:(NSURL * _Nullable)url options:(NSDictionary * _Nullable)options API_UNAVAILABLE(macos);
  451. /**
  452. Allow AppsFlyer to handle restoration from an NSUserActivity.
  453. Use this method to log deep links with OneLink.
  454. @param userActivity The NSUserActivity that caused the app to be opened.
  455. */
  456. - (BOOL)continueUserActivity:(NSUserActivity * _Nullable)userActivity
  457. restorationHandler:(void (^ _Nullable)(NSArray * _Nullable))restorationHandler NS_AVAILABLE_IOS(9_0) API_UNAVAILABLE(macos);
  458. /**
  459. Enable AppsFlyer to handle a push notification.
  460. @see [Learn more here](https://support.appsflyer.com/hc/en-us/articles/207364076-Measuring-Push-Notification-Re-Engagement-Campaigns)
  461. @warning To make it work - set data, related to AppsFlyer under key @"af".
  462. @param pushPayload The `userInfo` from received remote notification. One of root keys should be @"af".
  463. */
  464. - (void)handlePushNotification:(NSDictionary * _Nullable)pushPayload;
  465. /**
  466. Register uninstall - you should register for remote notification and provide AppsFlyer the push device token.
  467. @param deviceToken The `deviceToken` from `-application:didRegisterForRemoteNotificationsWithDeviceToken:`
  468. */
  469. - (void)registerUninstall:(NSData * _Nullable)deviceToken;
  470. /**
  471. Get SDK version.
  472. @return The AppsFlyer SDK version info.
  473. */
  474. - (NSString *)getSDKVersion;
  475. /**
  476. This is for internal use.
  477. */
  478. - (void)remoteDebuggingCallWithData:(NSString *)data;
  479. /**
  480. This is for internal use.
  481. */
  482. - (void)remoteDebuggingCallV2WithData:(NSString *)dataAsString;
  483. /**
  484. Used to force the trigger `onAppOpenAttribution` delegate.
  485. Notice, re-engagement, session and launch won't be counted.
  486. Only for OneLink/UniversalLink/Deeplink resolving.
  487. @param URL The param to resolve into -[AppsFlyerLibDelegate onAppOpenAttribution:]
  488. */
  489. - (void)performOnAppAttributionWithURL:(NSURL * _Nullable)URL;
  490. /**
  491. @brief This property accepts a string value representing the host name for all endpoints.
  492. Can be used to Zero rate your application’s data usage. Contact your CSM for more information.
  493. @warning To use `default` SDK endpoint – set value to `nil`.
  494. Objective-C:
  495. <pre>
  496. [[AppsFlyerLib shared] setHost:@"example.com"];
  497. </pre>
  498. Swift:
  499. <pre>
  500. AppsFlyerLib.shared().host = "example.com"
  501. </pre>
  502. */
  503. @property(nonatomic, strong, readonly) NSString *host;
  504. /**
  505. * This function set the host name and prefix host name for all the endpoints
  506. **/
  507. - (void)setHost:(NSString *)host withHostPrefix:(NSString *)hostPrefix;
  508. /**
  509. * This property accepts a string value representing the prefix host name for all endpoints.
  510. * for example "test" prefix with default host name will have the address "host.appsflyer.com"
  511. */
  512. @property(nonatomic, strong, readonly) NSString *hostPrefix;
  513. /**
  514. This property is responsible for timeout between sessions in seconds.
  515. Default value is 5 seconds.
  516. */
  517. @property(atomic) NSUInteger minTimeBetweenSessions;
  518. /**
  519. API to shut down all SDK activities.
  520. @warning This will disable all requests from AppsFlyer SDK.
  521. */
  522. @property(atomic) BOOL isStopped;
  523. /**
  524. API to set manually Facebook deferred app link
  525. */
  526. @property(nonatomic, nullable, copy) NSURL *facebookDeferredAppLink;
  527. /**
  528. Block an events from being shared with ad networks and other 3rd party integrations
  529. Must only include letters/digits or underscore, maximum length: 45
  530. */
  531. @property(nonatomic, nullable, copy) NSArray<NSString *> *sharingFilter DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForPartners:`");
  532. @property(nonatomic) NSUInteger deepLinkTimeout;
  533. /**
  534. Block an events from being shared with any partner
  535. This method overwrite -[AppsFlyerLib setSharingFilter:]
  536. */
  537. - (void)setSharingFilterForAllPartners DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForPartners:`");
  538. /**
  539. Block an events from being shared with ad networks and other 3rd party integrations
  540. Must only include letters/digits or underscore, maximum length: 45
  541. The sharing filter is cleared in case if `nil` or empty array passed as a parameter.
  542. "all" keyword sets sharing filter for ALL partners, it is case insencitive and has highest priority
  543. if passed along with another values. For example, if ["all", "examplePartner1_int", "examplePartner2_int" ] passed,
  544. the sharing filter will be set for ALL partners.
  545. */
  546. - (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
  547. /**
  548. Sets or updates the user consent data related to GDPR and DMA regulations for advertising and data usage
  549. purposes within the application. This method must be invoked with the user's current consent status each
  550. time the app starts or whenever there is a change in the user's consent preferences.
  551. Note that this method does not persist the consent data across app sessions; it only applies for the
  552. duration of the current app session. If you wish to stop providing the consent data, you should
  553. cease calling this method.
  554. @param consent an instance of AppsFlyerConsent that encapsulates the user's consent information.
  555. */
  556. - (void)setConsentData:(AppsFlyerConsent *)consent;
  557. /**
  558. Enable the SDK to collect and send TCF data
  559. @param shouldCollectConsentData indicates if the TCF data collection is enabled.
  560. */
  561. - (void)enableTCFDataCollection:(BOOL)shouldCollectConsentData;
  562. /**
  563. Validate if URL contains certain string and append quiery
  564. parameters to deeplink URL. In case if URL does not contain user-defined string,
  565. parameters are not appended to the url.
  566. @param containsString string to check in URL.
  567. @param parameters NSDictionary, which containins parameters to append to the deeplink url after it passed validation.
  568. */
  569. - (void)appendParametersToDeepLinkingURLWithString:(NSString *)containsString
  570. parameters:(NSDictionary<NSString *, NSString*> *)parameters
  571. NS_SWIFT_NAME(appendParametersToDeeplinkURL(contains:parameters:));
  572. /**
  573. Adds array of keys, which are used to compose key path
  574. to resolve deeplink from push notification payload `userInfo`.
  575. @param deepLinkPath an array of strings which contains keys to search for deeplink in payload.
  576. */
  577. - (void)addPushNotificationDeepLinkPath:(NSArray<NSString *> *)deepLinkPath;
  578. /**
  579. * Allows sending custom data for partner integration purposes.
  580. *
  581. * @param partnerId ID of the partner (usually has "_int" suffix)
  582. * @param partnerInfo customer data, depends on the integration nature with specific partner
  583. */
  584. - (void)setPartnerDataWithPartnerId:(NSString * _Nullable)partnerId partnerInfo:(NSDictionary<NSString *, id> * _Nullable)partnerInfo
  585. NS_SWIFT_NAME(setPartnerData(partnerId:partnerInfo:));
  586. @end
  587. NS_ASSUME_NONNULL_END