### Complete Event Tracking Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjevent.md A comprehensive example demonstrating how to create an event, set revenue, add various parameters, and include IAP-specific details before tracking. ```objc // Create event ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"g3mfiw"]; // Set revenue [event setRevenue:29.99 currency:@"USD"]; // Add callback parameters [event addCallbackParameter:@"user_id" value:@"123456"]; [event addCallbackParameter:@"subscription_tier" value:@"premium"]; // Add partner parameters [event addPartnerParameter:@"partner_user" value:@"user_789"]; // Set deduplication ID [event setDeduplicationId:@"purchase_20240101_001"]; // Set custom callback ID [event setCallbackId:@"purchase_event_123"]; // For IAP tracking [event setTransactionId:@"appstore_transaction_abc"]; [event setProductId:@"com.example.premium_subscription"]; // Validate and track if ([event isValid]) { [Adjust trackEvent:event]; } ``` -------------------------------- ### Full Adjust SDK Configuration Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/configuration.md A comprehensive example demonstrating how to initialize the Adjust SDK with various configuration options, including app token, environment, logging, privacy settings, and feature toggles. ```objc // Create configuration ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; // Logging config.logLevel = ADJLogLevelDebug; // User identification config.externalDeviceId = @"my_custom_device_id"; config.defaultTracker = @"organic_tracker"; // Privacy config.isCoppaComplianceEnabled = YES; config.attConsentWaitingInterval = 5; // Delegate for callbacks config.delegate = self; // Store info ADJStoreInfo *storeInfo = [[ADJStoreInfo alloc] initWithStoreName:@"app_store"]; config.storeInfo = storeInfo; // Feature toggles [config enableSendingInBackground]; [config enableCostDataInAttribution]; [config enableFirstSessionDelay]; // Data reading [config disableFbIdReading]; // Initialize SDK [Adjust initSdk:config]; ``` -------------------------------- ### Adjust Delegate Implementation Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/configuration.md Example implementation of several methods within the AdjustDelegate protocol, demonstrating how to handle attribution changes, successful and failed event tracking, and deferred deep links. ```objc - (void)adjustAttributionChanged:(ADJAttribution *)attribution { NSLog(@"Attribution: %@", attribution.network); } - (void)adjustEventTrackingSucceeded:(ADJEventSuccess *)event { NSLog(@"Event tracked: %@", event.eventToken); } - (void)adjustEventTrackingFailed:(ADJEventFailure *)event { NSLog(@"Event failed: %@", event.message); } - (BOOL)adjustDeferredDeeplinkReceived:(NSURL *)deeplink { NSLog(@"Deferred deeplink: %@", deeplink); return YES; // Let SDK open the deeplink } ``` -------------------------------- ### IronSource Ad Revenue Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjadrevenue.md Example demonstrating how to track IronSource ad revenue. Includes setting source, revenue, currency, network, unit, and placement. ```Objective-C // IronSource example ADJAdRevenue *ironsourceRevenue = [[ADJAdRevenue alloc] initWithSource:@"ironsource"]; [ironsourceRevenue setRevenue:0.50 currency:@"EUR"]; [ironsourceRevenue setAdRevenueNetwork:@"IronSource"]; [ironsourceRevenue setAdRevenueUnit:@"ironsource_unit_id"]; [ironsourceRevenue setAdRevenuePlacement:@"Rewarded_Video"]; [Adjust trackAdRevenue:ironsourceRevenue]; ``` -------------------------------- ### AdMob Ad Revenue Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjadrevenue.md Example demonstrating how to track AdMob ad revenue. Includes setting source, revenue, currency, impressions, network, unit, placement, and parameters. ```Objective-C // AdMob example ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:@"admob"]; [adRevenue setRevenue:1.25 currency:@"USD"]; [adRevenue setAdImpressionsCount:2]; [adRevenue setAdRevenueNetwork:@"AdMob"]; [adRevenue setAdRevenueUnit:@"ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx"]; [adRevenue setAdRevenuePlacement:@"Banner_Home"]; [adRevenue addCallbackParameter:@"ad_source" value:@"admob"]; [adRevenue addPartnerParameter:@"segment" value:@"premium_users"]; if ([adRevenue isValid]) { [Adjust trackAdRevenue:adRevenue]; } ``` -------------------------------- ### Full Adjust SDK Initialization with Store Info Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjstoreinfo.md This example demonstrates how to create and configure an ADJStoreInfo object, set it within ADJConfig, and then initialize the Adjust SDK. ```Objective-C // Create store information ADJStoreInfo *storeInfo = [[ADJStoreInfo alloc] initWithStoreName:@"app_store"]; // Set store app ID storeInfo.storeAppId = @"123456789"; // Use in config ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; config.storeInfo = storeInfo; // Initialize SDK [Adjust initSdk:config]; ``` -------------------------------- ### Adjust Delegate Protocol Example Implementation Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjconfig.md Example implementation of the AdjustDelegate protocol methods for handling attribution changes and event tracking results. Implement these methods to receive callbacks from the SDK. ```objc - (void)adjustAttributionChanged:(ADJAttribution *)attribution { NSLog(@"Attribution changed: %@ - %@", attribution.network, attribution.campaign); } - (void)adjustEventTrackingSucceeded:(ADJEventSuccess *)event { NSLog(@"Event tracked: %@", event.eventToken); } - (void)adjustEventTrackingFailed:(ADJEventFailure *)event { NSLog(@"Event failed: %@ - Retry: %d", event.eventToken, event.willRetry); } ``` -------------------------------- ### Verify and Track Event Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjappstore.md Example showing how to verify an App Store purchase and simultaneously track it as an event with revenue details. ```APIDOC ## Verify and Track Event ### Description Verifies an App Store purchase and tracks it as an event, including revenue and transaction details. ### Method Objective-C ### Usage ```objc - (void)verifyAndTrackPurchaseEvent:(SKPaymentTransaction *)transaction product:(SKProduct *)product { ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"abc123def"]; [event setRevenue:[NSDecimalNumber decimalNumberWithDecimal:product.price.decimalValue].doubleValue currency:[product.priceLocale objectForKey:NSLocaleCurrencyCode]]; [event setTransactionId:transaction.transactionIdentifier]; [event setProductId:product.productIdentifier]; [Adjust verifyAndTrackAppStorePurchase:event withCompletionHandler:^(ADJPurchaseVerificationResult *result) { if ([result.verificationStatus isEqualToString:@"success"]) { NSLog(@"Purchase verified and tracked"); } else { NSLog(@"Verification failed: %@", result.message); } }]; } ``` ``` -------------------------------- ### ADJEnvironmentSandbox Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/types.md Constant representing the sandbox environment for testing the Adjust SDK. Installs in this environment do not receive install credit. ```APIDOC ## ADJEnvironmentSandbox ### Description Sandbox environment for testing. Users in sandbox won't receive install credit. ### Value `"sandbox"` ### Usage Initialize SDK for testing/development ### Source `Adjust/Adjust.h:38` ``` -------------------------------- ### Basic Purchase Verification Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjappstore.md Example demonstrating how to create an ADJAppStorePurchase object and use it to verify a purchase with a completion handler. ```APIDOC ## Basic Purchase Verification ### Description Handles purchase verification by creating an `ADJAppStorePurchase` object and calling `verifyAppStorePurchase`. ### Method Objective-C ### Usage ```objc - (void)handlePurchaseVerification:(SKPaymentTransaction *)transaction product:(SKProduct *)product { ADJAppStorePurchase *purchase = [[ADJAppStorePurchase alloc] initWithTransactionId:transaction.transactionIdentifier productId:product.productIdentifier]; [Adjust verifyAppStorePurchase:purchase withCompletionHandler:^(ADJPurchaseVerificationResult *result) { NSLog(@"Verification Code: %d", result.code); NSLog(@"Verification Status: %@", result.verificationStatus); NSLog(@"Message: %@", result.message); if ([result.verificationStatus isEqualToString:@"success"]) { NSLog(@"Purchase verified successfully"); [self grantPremiumAccess]; } else { NSLog(@"Purchase verification failed"); [self showVerificationError:result.message]; } }]; } ``` ``` -------------------------------- ### Track Purchase via Event Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Example of tracking a purchase as an event in a `UIViewController`. ```APIDOC ## Track Purchase via Event ### Description Track in-app purchases by creating and tracking an `ADJEvent` object, including revenue details. ### Methods #### `ADJEvent` (initializer) Initializes an event with an event token. - **Parameters**: - `eventToken` (string) - The token representing the purchase event. #### `setRevenue:currency:` Sets the revenue and currency for the event. - **Parameters**: - `revenue` (double) - The revenue amount. - `currency` (string) - The currency code (e.g., "USD"). #### `trackEvent:` Tracks the event with the Adjust SDK. - **Parameters**: - `event` (`ADJEvent` object) - The event object containing purchase and revenue details. ### Request Example ```objc @interface MyViewController : UIViewController @end @implementation MyViewController // ... viewDidLoad method - (void)purchaseProduct { // Track purchase ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"purchase_token"]; [event setRevenue:9.99 currency:@"USD"]; [Adjust trackEvent:event]; } @end ``` ``` -------------------------------- ### Basic Link Resolution Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlinkresolution.md Demonstrates how to resolve a shortened Adjust link and handle the callback. If the link is resolved successfully, it logs the absolute string of the resolved link; otherwise, it logs a failure message. ```Objective-C NSURL *shortenedLink = [NSURL URLWithString:@"https://a.adjust.io/abc123"]; [ADJLinkResolution resolveLinkWithUrl:shortenedLink resolveUrlSuffixArray:nil callback:^(NSURL *resolvedLink) { if (resolvedLink) { NSLog(@"Resolved link: %@", resolvedLink.absoluteString); } else { NSLog(@"Failed to resolve link"); } }]; ``` -------------------------------- ### Get Attribution as Dictionary Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md Get the attribution object as a key-value dictionary. Returns all attribution properties. ```objc - (nullable NSDictionary *)dictionary; ``` ```objc ADJAttribution *attribution = /* ... */; NSDictionary *dict = [attribution dictionary]; NSLog(@"Attribution: %@", dict); ``` -------------------------------- ### Track Screen View via Event Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Example of tracking a screen view as an event in a `UIViewController`. ```APIDOC ## Track Screen View via Event ### Description Track screen views by creating and tracking an `ADJEvent` object. ### Methods #### `ADJEvent` (initializer) Initializes an event with an event token. - **Parameters**: - `eventToken` (string) - The token representing the screen view event. #### `trackEvent:` Tracks the event with the Adjust SDK. - **Parameters**: - `event` (`ADJEvent` object) - The event object to track. ### Request Example ```objc @interface MyViewController : UIViewController @end @implementation MyViewController - (void)viewDidLoad { [super viewDidLoad]; // Track screen view via event ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"screen_token"]; [Adjust trackEvent:event]; } // ... other methods @end ``` ``` -------------------------------- ### Track an Event with Revenue Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Create and track an event with a specific event token and associated revenue. The currency is set to 'USD' in this example. ```objc ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"g3mfiw"]; [event setRevenue:29.99 currency:@"USD"]; [Adjust trackEvent:event]; ``` -------------------------------- ### Example: Convert String to ADJLogLevel Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Demonstrates how to use the `logLevelFromString:` method to convert a string like "debug" into an ADJLogLevel enum, which can then be used to configure the SDK. ```objc ADJLogLevel level = [ADJLogger logLevelFromString:@"verbose"]; ``` -------------------------------- ### ADJEnvironmentProduction Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/types.md Constant representing the production environment for live applications using the Adjust SDK. Users in this environment will receive install credit. ```APIDOC ## ADJEnvironmentProduction ### Description Production environment for live apps. Users in production will receive install credit. ### Value `"production"` ### Usage Initialize SDK for production releases ### Source `Adjust/Adjust.h:39` ``` -------------------------------- ### Implement PSWebSocketServer in AppDelegate Source: https://github.com/adjust/ios_sdk/blob/master/AdjustTests/PocketSocket/README.md Configures and starts a WebSocket server on port 9001, implementing the PSWebSocketServerDelegate protocol to handle connection events. ```objective-c #import @interface AppDelegate() @property (nonatomic, strong) PSWebSocketServer *server; @end @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)notification { _server = [PSWebSocketServer serverWithHost:nil port:9001]; _server.delegate = self; [_server start]; } #pragma mark - PSWebSocketServerDelegate - (void)serverDidStart:(PSWebSocketServer *)server { NSLog(@"Server did start…"); } - (void)serverDidStop:(PSWebSocketServer *)server { NSLog(@"Server did stop…"); } - (BOOL)server:(PSWebSocketServer *)server acceptWebSocketWithRequest:(NSURLRequest *)request { NSLog(@"Server should accept request: %@", request); return YES; } - (void)server:(PSWebSocketServer *)server webSocket:(PSWebSocket *)webSocket didReceiveMessage:(id)message { NSLog(@"Server websocket did receive message: %@", message); } - (void)server:(PSWebSocketServer *)server webSocketDidOpen:(PSWebSocket *)webSocket { NSLog(@"Server websocket did open"); } - (void)server:(PSWebSocketServer *)server webSocket:(PSWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean { NSLog(@"Server websocket did close with code: %@, reason: %@, wasClean: %@", @(code), reason, @(wasClean)); } - (void)server:(PSWebSocketServer *)server webSocket:(PSWebSocket *)webSocket didFailWithError:(NSError *)error { NSLog(@"Server websocket did fail with error: %@", error); } @end ``` -------------------------------- ### Start Test SDK Session Source: https://github.com/adjust/ios_sdk/blob/master/AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/AdjustTestApp-WebView.html This JavaScript function is triggered by a button click to initiate a test session within the Adjust SDK via the web bridge. ```javascript window.onload = event => { console.log('Test Webview loaded'); }; function startButton() { console.log('btnStartTestSession'); TestLibraryBridge.startTestSession(); } ``` -------------------------------- ### Objective-C Nullability Annotations Example Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/types.md Illustrates the usage of Objective-C nullability annotations (_Nonnull, _Nullable, nullable, nonnull) in method signatures for indicating whether parameters or return values can be nil. ```objc - (void)trackEvent:(nullable ADJEvent *)event; - (void)initSdk:(nullable ADJConfig *)adjustConfig; + (nullable NSURL *)convertUniversalLink:(nonnull NSURL *)url withScheme:(nonnull NSString *)scheme; ``` -------------------------------- ### Configure SDK for Production vs Debug Builds Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Dynamically sets the Adjust SDK log level based on whether the build is for production or a debug build. Debug builds get more verbose logging, while production builds are less verbose. ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; #ifdef DEBUG // More verbose logging in debug builds config.logLevel = ADJLogLevelDebug; #else // Less verbose in production config.logLevel = ADJLogLevelError; #endif [Adjust initSdk:config]; ``` -------------------------------- ### Handle Remote Trigger with Error Handling Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjremotetrigger.md This example demonstrates how to handle different types of remote triggers, including error handling for unexpected exceptions. It logs unknown trigger types and tracks trigger processing errors using Adjust's event tracking. ```Objective-C - (void)adjustRemoteTriggerReceived:(ADJRemoteTrigger *)remoteTrigger { NSString *label = remoteTrigger.label; NSDictionary *payload = remoteTrigger.payload; @try { if ([label isEqualToString:@"promo"]) { [self applyPromo:payload]; } else { NSLog(@"Unknown trigger type: %@", label); } } @catch (NSException *exception) { NSLog(@"Error processing trigger %@: %@", label, exception.reason); // Log to analytics ADJEvent *errorEvent = [[ADJEvent alloc] initWithEventToken:@"trigger_error"]; [errorEvent addCallbackParameter:@"trigger_type" value:label]; [errorEvent addCallbackParameter:@"error" value:exception.reason]; [Adjust trackEvent:errorEvent]; } } ``` -------------------------------- ### adidWithCompletionHandler Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Gets the Adjust identifier (adid) for the user asynchronously. The result is provided via a completion handler block. The adid is only available after installation has been successfully tracked. ```APIDOC ## adidWithCompletionHandler ### Description Gets the Adjust identifier (adid) for the user. This method is asynchronous and returns the adid string or nil via a completion handler. The adid is only available after the installation has been successfully tracked. ### Method `+ (void)adidWithCompletionHandler:(nonnull ADJAdidGetterBlock)completion;` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Objective-C - **completion** (ADJAdidGetterBlock) - Yes - Callback receiving adid string or nil ### Callback Block ```objc typedef void(^ADJAdidGetterBlock)(NSString * _Nullable adid); ``` ### Notes The adid is only available after installation has been successfully tracked. ### Request Example ```objc [Adjust adidWithCompletionHandler:^(NSString *adid) { if (adid) { NSLog(@"Adid: %@", adid); } }]; ``` ### Response None ### Source `Adjust/Adjust.h:155` ``` -------------------------------- ### Retrieve Adid Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Get the Adjust identifier (adid) for the user. The adid is only available after installation has been successfully tracked. The callback block receives the adid string or nil. ```Objective-C [Adjust adidWithCompletionHandler:^(NSString *adid) { if (adid) { NSLog(@"Adid: %@", adid); } }]; ``` -------------------------------- ### Get Attribution Data Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieve the current user's attribution data. Attribution is available after installation tracking and backend data arrival. This method uses a completion handler to return the attribution object. ```objc + (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion; ``` ```objc [Adjust attributionWithCompletionHandler:^(ADJAttribution *attribution) { if (attribution) { NSLog(@"Network: %@", attribution.network); NSLog(@"Campaign: %@", attribution.campaign); } }]; ``` -------------------------------- ### initWithAppToken:environment: Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjconfig.md Creates a configuration object with the provided app token and environment. This is a fundamental step for initializing the Adjust SDK. ```APIDOC ## initWithAppToken:environment: ### Description Creates a configuration object with the provided app token and environment. This is a fundamental step for initializing the Adjust SDK. ### Method Objective-C ### Endpoint N/A (SDK Initialization) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; ``` ### Response #### Success Response - **Type:** ADJConfig* - **Description:** Configuration object or nil #### Response Example N/A (Object creation) ``` -------------------------------- ### Configure and Initialize Adjust SDK Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Initialize the Adjust SDK with your app token and environment. Configure logging level and set a delegate for callbacks. Ensure you replace 'YOUR_APP_TOKEN' with your actual app token. ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"YOUR_APP_TOKEN" environment:ADJEnvironmentProduction]; config.logLevel = ADJLogLevelInfo; config.delegate = self; [Adjust initSdk:config]; ``` -------------------------------- ### Initialize SDK in Swift Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Demonstrates how to initialize the Adjust SDK in a Swift project. Ensure you have the Adjust SDK integrated into your project. ```swift import Adjust let config = ADJConfig(appToken: "token", environment: ADJEnvironmentProduction) Adjust.initSdk(config) ``` -------------------------------- ### Initialize Adjust SDK in AppDelegate Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Initialize the Adjust SDK in `didFinishLaunchingWithOptions` using your app token and environment. Also includes setting the push token and handling deeplinks. ```objc - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize Adjust ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"YOUR_TOKEN" environment:ADJEnvironmentProduction]; [Adjust initSdk:config]; return YES; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // Set push token [Adjust setPushToken:deviceToken]; } - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { // Handle deeplinks ADJDeeplink *deeplink = [[ADJDeeplink alloc] initWithDeeplink:url]; [Adjust processDeeplink:deeplink]; return YES; } ``` -------------------------------- ### Implement PSWebSocket as a client Source: https://github.com/adjust/ios_sdk/blob/master/AdjustTests/PocketSocket/README.md Demonstrates initializing a client socket with a request, setting the delegate, and handling connection lifecycle events. ```objective-c # import @interface AppDelegate() @property (nonatomic, strong) PSWebSocket *socket; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; // create the NSURLRequest that will be sent as the handshake NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"wss://example.com"]]; // create the socket and assign delegate self.socket = [PSWebSocket clientSocketWithRequest:request]; self.socket.delegate = self; // open socket [self.socket open]; return YES; } #pragma mark - PSWebSocketDelegate - (void)webSocketDidOpen:(PSWebSocket *)webSocket { NSLog(@"The websocket handshake completed and is now open!"); [webSocket send:@"Hello world!"]; } - (void)webSocket:(PSWebSocket *)webSocket didReceiveMessage:(id)message { NSLog(@"The websocket received a message: %@", message); } - (void)webSocket:(PSWebSocket *)webSocket didFailWithError:(NSError *)error { NSLog(@"The websocket handshake/connection failed with an error: %@", error); } - (void)webSocket:(PSWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean { NSLog(@"The websocket closed with code: %@, reason: %@, wasClean: %@", @(code), reason, (wasClean) ? @"YES" : @"NO"); } @end ``` -------------------------------- ### SDK Initialization and Event Tracking Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md This snippet demonstrates the basic usage of the Adjust iOS SDK, including importing the SDK, configuring and initializing it with an app token and environment, and tracking a revenue event. ```APIDOC ## SDK Initialization and Event Tracking ### Description This section covers the essential steps for integrating the Adjust iOS SDK into your application. It includes importing the SDK, configuring essential parameters like the app token and environment, and tracking user events with associated revenue. ### Method Objective-C SDK methods ### Endpoint N/A (SDK usage) ### Parameters #### Initialization Parameters - **appToken** (string) - Required - Your unique Adjust App Token. - **environment** (ADJEnvironment) - Required - The SDK environment (e.g., ADJEnvironmentProduction, ADJEnvironmentSandbox). #### Configuration Options - **logLevel** (ADJLogLevel) - Optional - Sets the verbosity of SDK logs (e.g., ADJLogLevelInfo). - **delegate** (id) - Optional - Sets a delegate for receiving SDK callbacks. #### Event Tracking Parameters - **eventToken** (string) - Required - The unique identifier for the event. - **revenue** (double) - Optional - The revenue associated with the event. - **currency** (string) - Optional - The currency of the revenue (e.g., "USD"). ### Request Example ```objc // Import the SDK #import "Adjust.h" // Configure and Initialize ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"YOUR_APP_TOKEN" environment:ADJEnvironmentProduction]; config.logLevel = ADJLogLevelInfo; config.delegate = self; [Adjust initSdk:config]; // Track Events ADJEvent *event = [[ADJEvent alloc] initWithEventToken:@"g3mfiw"]; [event setRevenue:29.99 currency:@"USD"]; [Adjust trackEvent:event]; ``` ### Response #### Success Response - **Tracking Confirmation**: SDK internally processes the event and sends it to Adjust servers. #### Response Example N/A (SDK internal processing) ``` -------------------------------- ### Initialize ADJConfig with App Token and Environment Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjconfig.md Use this method to create a basic configuration object for the Adjust SDK. Specify your app token and the environment (sandbox or production). ```objc - (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken environment:(nonnull NSString *)environment; ``` ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; ``` -------------------------------- ### Initialize Adjust SDK in AppDelegate Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/configuration.md Demonstrates the essential steps for initializing the Adjust SDK within the `didFinishLaunchingWithOptions` method of your AppDelegate. ```objc - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; config.logLevel = ADJLogLevelInfo; config.delegate = self; [Adjust initSdk:config]; return YES; } ``` -------------------------------- ### Get Adjust Instance Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieve the singleton Adjust instance. Returns nil if not initialized. ```objc + (nullable instancetype)getInstance; ``` ```objc Adjust *adjust = [Adjust getInstance]; ``` -------------------------------- ### defaultTracker Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjconfig.md The defaultTracker property sets a default tracker for attributing organic installs. ```APIDOC ## defaultTracker ### Description The defaultTracker property sets a default tracker for attributing organic installs. ### Property Type NSString* ### Access Read-write ### Example ```objc config.defaultTracker = @"organic_tracker_token"; ``` ``` -------------------------------- ### Handling Attribution Changes Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Provides an example of implementing the `adjustAttributionChanged` delegate method to receive attribution updates. ```APIDOC ## Handling Attribution Changes ### Description Implement the `AdjustDelegate` protocol to receive callbacks for attribution changes. ### Methods #### `adjustAttributionChanged:` Callback method invoked when attribution data changes. - **Parameters**: - `attribution` (`ADJAttribution` object) - Contains updated attribution details. ### Response Example - **Attribution Details** (`ADJAttribution` object) - `network` (string) - `campaign` (string) - `adgroup` (string) - `creative` (string) ```objc - (void)adjustAttributionChanged:(ADJAttribution *)attribution { NSLog(@"Network: %@", attribution.network); NSLog(@"Campaign: %@", attribution.campaign); NSLog(@"Adgroup: %@", attribution.adgroup); NSLog(@"Creative: %@", attribution.creative); } ``` ``` -------------------------------- ### initSdk Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Initializes the Adjust SDK with the provided configuration. This method should be called during the application's launch sequence. ```APIDOC ## initSdk ### Description Initializes the Adjust SDK with configuration. This must be called in the `didFinishLaunching` method of your AppDelegate. ### Method `+ (void)initSdk:(nullable ADJConfig *)adjustConfig;` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * **adjustConfig** (ADJConfig*) - Yes - Configuration object containing environment and App Token ### Request Example ```objc ADJConfig *adjustConfig = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentSandbox]; [Adjust initSdk:adjustConfig]; ``` ### Response #### Success Response * None #### Response Example * None **Notes:** The App Token is a unique 12-character identifier from your Adjust dashboard at http://adjust.com ``` -------------------------------- ### initWithStoreName: Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjstoreinfo.md Creates a store info object with the specified store name. This is the primary initializer for ADJStoreInfo. ```APIDOC ## initWithStoreName: ### Description Creates a store info object with the specified store name. This is the primary initializer for ADJStoreInfo. ### Method Objective-C initializer ### Parameters #### Path Parameters - **storeName** (NSString*) - Required - Name of the app store ### Response #### Success Response - Returns an ADJStoreInfo object or nil if initialization fails. ### Request Example ```objc ADJStoreInfo *storeInfo = [[ADJStoreInfo alloc] initWithStoreName:@"app_store"]; ``` ``` -------------------------------- ### Initialize ADJAppStoreSubscription Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjappstoresubscription.md Create a subscription object with required information: price, currency, and transaction ID. Ensure the price is an NSDecimalNumber and the currency is a 3-character ISO 4217 code. ```objc - (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price currency:(nonnull NSString *)currency transactionId:(nonnull NSString *)transactionId; ``` ```objc NSDecimalNumber *price = [[NSDecimalNumber alloc] initWithString:@"4.99"]; ADJAppStoreSubscription *subscription = [[ADJAppStoreSubscription alloc] initWithPrice:price currency:@"USD" transactionId:@"1000000000000001"]; ``` -------------------------------- ### Get Last Deeplink Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieves the last deeplink URL that opened the app. The callback receives the deeplink URL if available. ```Objective-C + (void)lastDeeplinkWithCompletionHandler:(nonnull ADJLastDeeplinkGetterBlock)completion; ``` ```Objective-C [Adjust lastDeeplinkWithCompletionHandler:^(NSURL *deeplink) { if (deeplink) { NSLog(@"Last deeplink: %@", deeplink.absoluteString); } }]; ``` -------------------------------- ### Initialize Adjust SDK Source: https://github.com/adjust/ios_sdk/blob/master/examples/AdjustExample-WebView/AdjustExample-WebView/AdjustExample-WebView.html Initializes the Adjust SDK with configuration. Set log level, and various callbacks for attribution, event, and session success/failure. Deferred deep link and SKAdNetwork callbacks are also configurable. ```javascript window.onload = event => { initSdk(); }; function initSdk() { var adjustConfig = new AdjustConfig('2fm9gkqubvpc', AdjustConfig.EnvironmentSandbox); adjustConfig.setLogLevel(AdjustConfig.LogLevelVerbose); adjustConfig.setAttributionCallback(function(attributionData) { console.log(attributionData); }); adjustConfig.setEventSuccessCallback(function(eventSuccessResponseData) { console.log(eventSuccessResponseData); }); adjustConfig.setEventFailureCallback(function(eventFailureResponseData) { console.log(eventFailureResponseData); }); adjustConfig.setSessionSuccessCallback(function(sessionSuccessResponseData) { console.log(sessionSuccessResponseData); }); adjustConfig.setSessionFailureCallback(function(sessionFailureResponseData) { console.log(sessionFailureResponseData); }); adjustConfig.setDeferredDeeplinkCallback(function(deferredDeeplinkResponseData) { console.log(deferredDeeplinkResponseData); }); adjustConfig.setSkanUpdatedCallback(function(skanData) { console.log(skanData); }); Adjust.initSdk(adjustConfig); } ``` -------------------------------- ### Get SDK Version Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieve the Adjust SDK version string. The completion handler receives the SDK version in the format 'iosX.Y.Z'. ```objc + (void)sdkVersionWithCompletionHandler:(nonnull ADJSdkVersionGetterBlock)completion; ``` ```objc [Adjust sdkVersionWithCompletionHandler:^(NSString *sdkVersion) { NSLog(@"SDK Version: %@", sdkVersion); }]; ``` -------------------------------- ### adidWithTimeout:completionHandler: Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Gets the Adjust identifier (adid) for the user with a specified timeout. The result is provided via a completion handler block. ```APIDOC ## adidWithTimeout:completionHandler: ### Description Gets the Adjust identifier (adid) for the user with a specified timeout. This method is asynchronous and returns the adid string or nil if the timeout is reached, via a completion handler. ### Method `+ (void)adidWithTimeout:(NSInteger)timeoutMs completionHandler:(nonnull ADJAdidGetterBlock)completion;` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Objective-C - **timeoutMs** (NSInteger) - Yes - Timeout in milliseconds - **completion** (ADJAdidGetterBlock) - Yes - Callback receiving adid or nil if timeout ### Callback Block ```objc typedef void(^ADJAdidGetterBlock)(NSString * _Nullable adid); ``` ### Request Example ```objc [Adjust adidWithTimeout:5000 completionHandler:^(NSString *adid) { NSLog(@"Adid: %@", adid ?: @"Not available"); }]; ``` ### Response None ### Source `Adjust/Adjust.h:166` ``` -------------------------------- ### Configure SDK for Development with Verbose Logging Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Sets up the Adjust SDK for a development environment (sandbox) with verbose logging enabled. This is useful for debugging during development. ```objc // Verbose logging for development ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentSandbox]; config.logLevel = ADJLogLevelVerbose; [Adjust initSdk:config]; ``` -------------------------------- ### Initialize ADJConfig with App Token and Environment Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/configuration.md Use this constructor to initialize the ADJConfig object with the required app token and environment. The environment can be set to ADJEnvironmentSandbox or ADJEnvironmentProduction. ```objc - (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken environment:(nonnull NSString *)environment; ``` ```objc - (nullable ADJConfig *)initWithAppToken:(nonnull NSString *)appToken environment:(nonnull NSString *)environment suppressLogLevel:(BOOL)allowSuppressLogLevel; ``` ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; ``` -------------------------------- ### ADJAttributionGetterBlock Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/types.md Block called with attribution data. This callback provides the attribution information for the user, which can be used to understand the source of the app install. ```APIDOC ## ADJAttributionGetterBlock ### Description Block called with attribution data. This callback provides the attribution information for the user, which can be used to understand the source of the app install. ### Parameters | Parameter | Type | Description | |---|---|---| | attribution | ADJAttribution* | Attribution object or nil | ### Used By - `Adjust.attributionWithCompletionHandler:` - `Adjust.attributionWithTimeout:completionHandler:` ``` -------------------------------- ### Initialize ADJAdRevenue Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjadrevenue.md Create an ad revenue object for a specified ad network source. Use this to begin tracking ad revenue for a particular network. ```Objective-C ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc] initWithSource:@"admob"]; ``` -------------------------------- ### Access Adgroup Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md The ad group name. Examples include "Premium Users" or "Acquisition". ```objc @property (nonatomic, copy, nullable) NSString *adgroup; ``` -------------------------------- ### Initialize Adjust SDK Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Provides the code for initializing the Adjust SDK in your application's `AppDelegate`. ```APIDOC ## Initialize Adjust SDK ### Description Initialize the Adjust SDK during your application's launch. ### Methods #### `ADJConfig` (initializer) Initializes the SDK configuration. - **Parameters**: - `appToken` (string) - Your Adjust App Token. - `environment` (string) - The SDK environment (e.g., `ADJEnvironmentProduction`). #### `initSdk:` Initializes the Adjust SDK with the provided configuration. - **Parameters**: - `config` (`ADJConfig` object) - The SDK configuration object. ### Request Example ```objc - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize Adjust ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"YOUR_TOKEN" environment:ADJEnvironmentProduction]; [Adjust initSdk:config]; return YES; } ``` ``` -------------------------------- ### Access Tracker Name Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md The name of the tracker. Examples include "Organic" or "Google Ads". ```objc @property (nonatomic, copy, nullable) NSString *trackerName; ``` -------------------------------- ### Setting Global Parameters Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Demonstrates how to set global callback and partner parameters that apply to all tracked events and sessions. ```APIDOC ## Setting Global Parameters ### Description Set global parameters that will be sent with every event and session. ### Methods #### `addGlobalCallbackParameter:forKey:` Adds a global callback parameter. - **Parameters**: - `value` (string) - The value of the parameter. - `key` (string) - The key for the parameter. #### `addGlobalPartnerParameter:forKey:` Adds a global partner parameter. - **Parameters**: - `value` (string) - The value of the parameter. - `key` (string) - The key for the parameter. ### Request Example ```objc [Adjust addGlobalCallbackParameter:@"user_123" forKey:@"user_id"]; [Adjust addGlobalPartnerParameter:@"segment_premium" forKey:@"user_segment"]; ``` ``` -------------------------------- ### attributionWithCompletionHandler: Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieves the current user attribution data. This method should be called after the SDK has successfully tracked an installation and received attribution information from the backend. ```APIDOC ## attributionWithCompletionHandler: ### Description Get current attribution for the user. Attribution is only available after installation has been successfully tracked and attribution data has arrived from the backend. ### Method `+ (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion;` ### Parameters #### Callback Block - **completion** (ADJAttributionGetterBlock) - Yes - Callback receiving attribution object **Callback Block Definition:** ```objc typedef void(^ADJAttributionGetterBlock)(ADJAttribution * _Nullable attribution); ``` ### Example ```objc [Adjust attributionWithCompletionHandler:^(ADJAttribution *attribution) { if (attribution) { NSLog(@"Network: %@", attribution.network); NSLog(@"Campaign: %@", attribution.campaign); } }]; ``` ``` -------------------------------- ### Configure Adjust SDK with Conditional Logging Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Initializes the Adjust SDK with an app token and sets the environment (production or sandbox) based on the build. Log levels are adjusted to 'Warn' for production and 'Debug' for other environments to control log verbosity. ```Objective-C - (void)setupAdjustWithConfig { ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:[self isProductionBuild] ? ADJEnvironmentProduction : ADJEnvironmentSandbox]; // Adjust log level based on build if ([self isProductionBuild]) { config.logLevel = ADJLogLevelWarn; // Minimal logging } else { config.logLevel = ADJLogLevelDebug; // Detailed logging } [Adjust initSdk:config]; } - (BOOL)isProductionBuild { // Determine if running production build return [[NSBundle mainBundle].bundleIdentifier hasSuffix:@".prod"]; } ``` -------------------------------- ### Set Default Tracker Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjconfig.md Specify a default tracker token for attributing organic installs. This helps in tracking users who do not come from a tracked source. ```objc config.defaultTracker = @"organic_tracker_token"; ``` -------------------------------- ### Handle Remote Trigger Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Implement the `adjustRemoteTriggerReceived` delegate method to process remote trigger labels and payloads. Example shows applying a promotion. ```objc - (void)adjustRemoteTriggerReceived:(ADJRemoteTrigger *)remoteTrigger { if ([remoteTrigger.label isEqualToString:@"promo"]) { [self applyPromotion:remoteTrigger.payload]; } } ``` -------------------------------- ### Initialize ADJStoreInfo with Store Name Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjstoreinfo.md Use this initializer to create an ADJStoreInfo object with the name of the app store. Supported store names include 'app_store' for the Apple App Store and others for sideloading. ```Objective-C - (nullable id)initWithStoreName:(nonnull NSString *)storeName; ``` ```Objective-C ADJStoreInfo *storeInfo = [[ADJStoreInfo alloc] initWithStoreName:@"app_store"]; ``` -------------------------------- ### Access Campaign Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md The campaign name. Examples include "Summer Sale" or "iOS App Campaign". ```objc @property (nonatomic, copy, nullable) NSString *campaign; ``` -------------------------------- ### Import Callback Response Classes Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjcallbackresponses.md Import the necessary header files for event and session success and failure response objects. ```objc #import "ADJEventSuccess.h" #import "ADJEventFailure.h" #import "ADJSessionSuccess.h" #import "ADJSessionFailure.h" ``` -------------------------------- ### Configure SDK with String Log Level Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Initializes the Adjust SDK by first converting a string representation of a log level (e.g., "debug") to an ADJLogLevel enum, then setting it on the ADJConfig object. ```objc NSString *logLevelString = @"debug"; ADJLogLevel level = [ADJLogger logLevelFromString:logLevelString]; ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; config.logLevel = level; [Adjust initSdk:config]; ``` -------------------------------- ### Get App Tracking Authorization Status Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieves the current App Tracking Authorization status. Returns an integer representing the ATTrackingManager authorization status. ```objc + (int)appTrackingAuthorizationStatus; ``` ```objc int status = [Adjust appTrackingAuthorizationStatus]; ``` -------------------------------- ### Select Adjust SDK Environment Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/configuration.md Code snippets for selecting the appropriate environment for the Adjust SDK, either for development/testing (Sandbox) or production. ```objc // Development/Testing NSString *environment = ADJEnvironmentSandbox; // Production NSString *environment = ADJEnvironmentProduction; ``` -------------------------------- ### Get Third-Party Sharing Settings Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Retrieve current third-party sharing settings with a timeout. The callback block provides the sharing settings result or nil. ```objc + (void)thirdPartySharingSettingsWithTimeout:(NSInteger)timeoutMs completionHandler:(nonnull ADJThirdPartySharingGetterBlock)completion; ``` -------------------------------- ### Initialize Adjust SDK Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Initialize the Adjust SDK with a configuration object. This method must be called in the `didFinishLaunching` method of your AppDelegate. The App Token is a 12-character identifier from your Adjust dashboard. ```Objective-C #import "Adjust.h" #import "ADJConfig.h" // ... in didFinishLaunching: ADJConfig *adjustConfig = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentSandbox]; [Adjust initSdk:adjustConfig]; ``` -------------------------------- ### Retrieve Adid with Timeout Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjust.md Get the Adjust identifier (adid) with a specified timeout in milliseconds. The callback block receives the adid or nil if the timeout occurs. ```Objective-C [Adjust adidWithTimeout:5000 completionHandler:^(NSString *adid) { NSLog(@"Adid: %@", adid ?: @"Not available"); }]; ``` -------------------------------- ### Configure SDK with Log Level in ADJConfig Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjlogger.md Initializes the Adjust SDK with a specific app token and environment, setting the log level directly on the ADJConfig object. This is the standard way to configure logging. ```objc ADJConfig *config = [[ADJConfig alloc] initWithAppToken:@"1234567890ab" environment:ADJEnvironmentProduction]; // Set log level config.logLevel = ADJLogLevelVerbose; [Adjust initSdk:config]; ``` -------------------------------- ### Access Network Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md The ad network name. Examples include "google", "facebook", or "apple_search_ads". ```objc @property (nonatomic, copy, nullable) NSString *network; ``` -------------------------------- ### Access Creative Property Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjattribution.md The creative name or description. Examples include "Banner - Blue CTA" or "Video Ad - 30s". ```objc @property (nonatomic, copy, nullable) NSString *creative; ``` -------------------------------- ### ADJAppStoreSubscription Initialization Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjappstoresubscription.md Initializes an ADJAppStoreSubscription object with essential purchase details. This includes the subscription price, currency, and the unique transaction identifier from the App Store. ```APIDOC ## initWithPrice:currency:transactionId: ### Description Create a subscription object with required information. ### Method Objective-C ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **price** (NSDecimalNumber*) - Required - Subscription price - **currency** (NSString*) - Required - 3-character ISO 4217 currency code - **transactionId** (NSString*) - Required - App Store transaction identifier ### Request Example ```objc NSDecimalNumber *price = [[NSDecimalNumber alloc] initWithString:@"4.99"]; ADJAppStoreSubscription *subscription = [[ADJAppStoreSubscription alloc] initWithPrice:price currency:@"USD" transactionId:@"1000000000000001"]; ``` ### Response #### Success Response (200) - **ADJAppStoreSubscription*** - Subscription object or nil ``` -------------------------------- ### Import Adjust SDK Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/README.md Import the main Adjust SDK header file to begin using its functionalities. ```objc #import "Adjust.h" ``` -------------------------------- ### Initialize ADJThirdPartySharing Source: https://github.com/adjust/ios_sdk/blob/master/_autodocs/api-reference/adjthirdpartysharing.md Create an ADJThirdPartySharing object to configure third-party data sharing. Use @YES to enable, @NO to disable, or nil to indicate no global change. ```objc // Enable third-party sharing ADJThirdPartySharing *sharing = [[ADJThirdPartySharing alloc] initWithIsEnabled:@YES]; // Disable third-party sharing ADJThirdPartySharing *sharing = [[ADJThirdPartySharing alloc] initWithIsEnabled:@NO]; // No global change, only partner-specific settings ADJThirdPartySharing *sharing = [[ADJThirdPartySharing alloc] initWithIsEnabled:nil]; ```