diff --git a/Adjust.podspec b/Adjust.podspec index c6712c7c4..0922a6fa7 100644 --- a/Adjust.podspec +++ b/Adjust.podspec @@ -1,14 +1,14 @@ Pod::Spec.new do |s| s.name = "Adjust" - s.version = "3.3.0" + s.version = "3.3.1" s.summary = "This is the iOS SDK of Adjust. You can read more about it at http://adjust.io." s.homepage = "http://adjust.io" s.license = { :type => 'MIT', :file => 'MIT-LICENSE' } s.author = { "Christian Wellenbrock" => "welle@adjust.com" } - s.source = { :git => "https://github.com/adeven/adjust_ios_sdk.git", :tag => "v3.3.0" } + s.source = { :git => "https://github.com/adeven/adjust_ios_sdk.git", :tag => "v3.3.1" } s.platform = :ios, '4.3' s.framework = 'SystemConfiguration' - s.weak_framework = 'AdSupport' + s.weak_framework = 'AdSupport', 'iAd' s.source_files = 'Adjust/*.{h,m}', 'Adjust/AIAdditions/*.{h,m}' s.requires_arc = true end diff --git a/Adjust.xcodeproj/project.pbxproj b/Adjust.xcodeproj/project.pbxproj index 9a04e31ff..e07a33dcb 100644 --- a/Adjust.xcodeproj/project.pbxproj +++ b/Adjust.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 96325E89190E892000A97911 /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96325E86190E5CE400A97911 /* iAd.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 96325E8A190E892600A97911 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96325E84190E5CD900A97911 /* AdSupport.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 96325E8B190E8D6200A97911 /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96325E86190E5CE400A97911 /* iAd.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 96325E8C190E8D6B00A97911 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96325E84190E5CD900A97911 /* AdSupport.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 9679921118BBAE2800394606 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9679921018BBAE2800394606 /* Foundation.framework */; }; 9679921F18BBAE2800394606 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9679921E18BBAE2800394606 /* XCTest.framework */; }; 9679922018BBAE2800394606 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9679921018BBAE2800394606 /* Foundation.framework */; }; @@ -67,6 +71,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 96325E84190E5CD900A97911 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; + 96325E86190E5CE400A97911 /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; }; 9679920D18BBAE2800394606 /* libAdjust.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAdjust.a; sourceTree = BUILT_PRODUCTS_DIR; }; 9679921018BBAE2800394606 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9679921D18BBAE2800394606 /* AdjustTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdjustTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -129,6 +135,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 96325E8A190E892600A97911 /* AdSupport.framework in Frameworks */, + 96325E89190E892000A97911 /* iAd.framework in Frameworks */, 9679921118BBAE2800394606 /* Foundation.framework in Frameworks */, 96E5E3B918BBB75F008E7B30 /* XCTest.framework in Frameworks */, ); @@ -138,6 +146,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 96325E8C190E8D6B00A97911 /* AdSupport.framework in Frameworks */, + 96325E8B190E8D6200A97911 /* iAd.framework in Frameworks */, 9679922518BBAE2800394606 /* libAdjust.a in Frameworks */, 9679921F18BBAE2800394606 /* XCTest.framework in Frameworks */, 9679922218BBAE2800394606 /* UIKit.framework in Frameworks */, @@ -170,6 +180,8 @@ 9679920F18BBAE2800394606 /* Frameworks */ = { isa = PBXGroup; children = ( + 96325E86190E5CE400A97911 /* iAd.framework */, + 96325E84190E5CD900A97911 /* AdSupport.framework */, 9679921018BBAE2800394606 /* Foundation.framework */, 9679921E18BBAE2800394606 /* XCTest.framework */, 9679922118BBAE2800394606 /* UIKit.framework */, @@ -421,8 +433,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = "-DADJUST_NO_IDA"; SDKROOT = iphoneos; }; name = Debug; @@ -452,7 +465,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + OTHER_CFLAGS = "-DADJUST_NO_IDA"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; @@ -505,6 +519,7 @@ "$(inherited)", ); INFOPLIST_FILE = "AdjustTests/AdjustTests-Info.plist"; + OTHER_CFLAGS = "-DADJUST_NO_IDA"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xctest; }; @@ -521,6 +536,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "AdjustTests/Adjust-Prefix.pch"; INFOPLIST_FILE = "AdjustTests/AdjustTests-Info.plist"; + OTHER_CFLAGS = "-DADJUST_NO_IDA"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xctest; }; diff --git a/Adjust/AIActivityHandler.m b/Adjust/AIActivityHandler.m index 2b8008cf1..c0c4731b8 100644 --- a/Adjust/AIActivityHandler.m +++ b/Adjust/AIActivityHandler.m @@ -17,6 +17,9 @@ #import "UIDevice+AIAdditions.h" #import "NSString+AIAdditions.h" #import "AIAdjustFactory.h" +#if !ADJUST_NO_IDA +#import +#endif static NSString * const kActivityStateFilename = @"AdjustIoActivityState"; static NSString * const kAdjustPrefix = @"adjust_"; @@ -44,6 +47,8 @@ @interface AIActivityHandler() @property (nonatomic, copy) NSString *clientSdk; @property (nonatomic, assign) BOOL trackingEnabled; @property (nonatomic, assign) BOOL internalEnabled; +@property (nonatomic, assign) BOOL isIad; +@property (nonatomic, copy) NSString *vendorId; @end @@ -163,6 +168,15 @@ - (void)initInternal:(NSString *)yourAppToken { self.idForAdvertisers = UIDevice.currentDevice.aiIdForAdvertisers; self.fbAttributionId = UIDevice.currentDevice.aiFbAttributionId; self.userAgent = AIUtil.userAgent; + self.vendorId = UIDevice.currentDevice.aiVendorId; + +#if !ADJUST_NO_IDA + if (NSClassFromString(@"ADClient")) { + [ADClient.sharedClient determineAppInstallationAttributionWithCompletionHandler:^(BOOL appInstallationWasAttributedToiAd) { + self.isIad = appInstallationWasAttributedToiAd; + }]; + } +#endif self.packageHandler = [AIAdjustFactory packageHandlerForActivityHandler:self]; [self readActivityState]; @@ -430,6 +444,8 @@ - (void)injectGeneralAttributes:(AIPackageBuilder *)builder { builder.idForAdvertisers = self.idForAdvertisers; builder.fbAttributionId = self.fbAttributionId; builder.environment = self.environment; + builder.isIad = self.isIad; + builder.vendorId = self.vendorId; if (self.trackMacMd5) { builder.macShortMd5 = self.macShortMd5; diff --git a/Adjust/AIAdditions/UIDevice+AIAdditions.h b/Adjust/AIAdditions/UIDevice+AIAdditions.h index 82991681e..d5eb3624b 100644 --- a/Adjust/AIAdditions/UIDevice+AIAdditions.h +++ b/Adjust/AIAdditions/UIDevice+AIAdditions.h @@ -17,5 +17,6 @@ - (NSString *)aiDeviceType; - (NSString *)aiDeviceName; - (NSString *)aiCreateUuid; +- (NSString *)aiVendorId; @end diff --git a/Adjust/AIAdditions/UIDevice+AIAdditions.m b/Adjust/AIAdditions/UIDevice+AIAdditions.m index 929fca3c6..7fca35709 100644 --- a/Adjust/AIAdditions/UIDevice+AIAdditions.m +++ b/Adjust/AIAdditions/UIDevice+AIAdditions.m @@ -158,4 +158,9 @@ - (NSString *)aiCreateUuid { return lowerUuid; } +- (NSString *)aiVendorId { + NSString * vendorId = [UIDevice.currentDevice.identifierForVendor UUIDString]; + return vendorId; +} + @end diff --git a/Adjust/AIPackageBuilder.h b/Adjust/AIPackageBuilder.h index 8e356664a..91c1bd423 100644 --- a/Adjust/AIPackageBuilder.h +++ b/Adjust/AIPackageBuilder.h @@ -22,6 +22,8 @@ @property (nonatomic, copy) NSString *clientSdk; @property (nonatomic, copy) NSString *uuid; @property (nonatomic, assign) BOOL trackingEnabled; +@property (nonatomic, assign) BOOL isIad; +@property (nonatomic, copy) NSString *vendorId; // sessions @property (nonatomic, assign) int sessionCount; diff --git a/Adjust/AIPackageBuilder.m b/Adjust/AIPackageBuilder.m index d52ffafef..0f01fdf8f 100644 --- a/Adjust/AIPackageBuilder.m +++ b/Adjust/AIPackageBuilder.m @@ -88,6 +88,8 @@ - (NSMutableDictionary *)defaultParameters { [self parameters:parameters setString:self.fbAttributionId forKey:@"fb_id"]; [self parameters:parameters setString:self.environment forKey:@"environment"]; [self parameters:parameters setInt:self.trackingEnabled forKey:@"tracking_enabled"]; + [self parameters:parameters setBool:self.isIad forKey:@"is_iad"]; + [self parameters:parameters setString:self.vendorId forKey:@"idfv"]; // session related (used for events as well) [self parameters:parameters setInt:self.sessionCount forKey:@"session_count"]; @@ -167,5 +169,12 @@ - (void)parameters:(NSMutableDictionary *)parameters setDictionaryJson:(NSDictio [self parameters:parameters setString:dictionaryString forKey:key]; } +- (void)parameters:(NSMutableDictionary *)parameters setBool:(BOOL)value forKey:(NSString *)key { + if (value < 0) return; + + int valueInt = [[NSNumber numberWithBool:value] intValue]; + + [self parameters:parameters setInt:valueInt forKey:key]; +} @end diff --git a/Adjust/AIUtil.m b/Adjust/AIUtil.m index ef7c9cac7..a5af099ae 100644 --- a/Adjust/AIUtil.m +++ b/Adjust/AIUtil.m @@ -14,7 +14,7 @@ #include static NSString * const kBaseUrl = @"https://app.adjust.io"; -static NSString * const kClientSdk = @"ios3.3.0"; +static NSString * const kClientSdk = @"ios3.3.1"; static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'Z"; static NSDateFormatter * dateFormat; diff --git a/AdjustTests/AIActivityHandlerTests.m b/AdjustTests/AIActivityHandlerTests.m index 5310b5efd..40cda79f3 100644 --- a/AdjustTests/AIActivityHandlerTests.m +++ b/AdjustTests/AIActivityHandlerTests.m @@ -88,7 +88,7 @@ - (void)testFirstRun AIActivityPackage *activityPackage = (AIActivityPackage *) self.packageHandlerMock.packageQueue[0]; // check the Sdk version is being tested - XCTAssertEqual(@"ios3.3.0", activityPackage.clientSdk, @"%@", activityPackage.extendedString); + XCTAssertEqual(@"ios3.3.1", activityPackage.clientSdk, @"%@", activityPackage.extendedString); // packageType should be SESSION_START XCTAssertEqual(@"/startup", activityPackage.path, @"%@", activityPackage.extendedString); @@ -112,6 +112,12 @@ - (void)testFirstRun // lastInterval -1, same as before XCTAssertNil(parameters[@"last_interval"], @"%@", activityPackage.extendedString); + // is_iad should be false + XCTAssertEqual(NO, [(NSString *)parameters[@"is_iad"] boolValue], @"%@", activityPackage.extendedString); + + // vendorId of the simulator + XCTAssertNotNil((NSString *)parameters[@"idfv"], @"%@", activityPackage.extendedString); + // after adding, the activity handler ping the Package handler to send the package XCTAssert([self.loggerMock containsMessage:AILogLevelTest beginsWith:@"AIPackageHandler sendFirstPackage"], @"%@", self.loggerMock); diff --git a/README.md b/README.md index 21eeace9f..f565764d5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If you're using [CocoaPods][cocoapods], you can add the following line to your `Podfile` and continue with [step 3](#step3): ```ruby -pod 'Adjust', :git => 'git://github.com/adjust/ios_sdk.git', :tag => 'v3.3.0' +pod 'Adjust', :git => 'git://github.com/adjust/ios_sdk.git', :tag => 'v3.3.1' ``` ### 1. Get the SDK @@ -35,14 +35,14 @@ radio button to `Create groups for any added folders`. ![][add] -### 3. Add the AdSupport framework +### 3. Add the AdSupport and iAd framework In the Project Navigator select your project. In the left hand side of the main view select your target. In the tab `Build Phases` expand the group `Link Binary with Libraries`. On the bottom of that group click on the `+` button. -Select the `AdSupport.framework` and click the `Add` button. In the list of -frameworks select the newly added `AdSupport.framework` and change the -attribute `Required` to `Optional`. +Select the `AdSupport.framework` and click the `Add` button. Repeat the same step to +add the `iAd.framework`. In the list of frameworks select the newly added `AdSupport.framework` +and `iAd.framework`. Change the attribute `Required` to `Optional`. ![][framework] @@ -337,7 +337,7 @@ or add the method `openURL` and add the following call to adjust: [transition]: http://developer.apple.com/library/mac/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html [drag]: https://raw.github.com/adjust/sdks/master/Resources/ios/drag3.png [add]: https://raw.github.com/adjust/sdks/master/Resources/ios/add2.png -[framework]: https://raw.github.com/adjust/sdks/master/Resources/ios/framework2.png +[framework]: https://raw.github.com/adjust/sdks/master/Resources/ios/framework3.png [delegate]: https://raw.github.com/adjust/sdks/master/Resources/ios/delegate3.png [run]: https://raw.github.com/adjust/sdks/master/Resources/ios/run3.png [AEPriceMatrix]: https://github.com/adjust/AEPriceMatrix diff --git a/VERSION b/VERSION index 15a279981..bea438e9a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.0 +3.3.1 diff --git a/doc/migrate.md b/doc/migrate.md index 7b81dd9db..6dec9a718 100644 --- a/doc/migrate.md +++ b/doc/migrate.md @@ -1,4 +1,4 @@ -## Migrate your adjust SDK for iOS to v3.3.0 from v3.0.0 +## Migrate your adjust SDK for iOS to v3.3.1 from v3.0.0 We added an optional parameter `transactionId` to our `trackRevenue` methods. If you are tracking In-App Purchases you might want to pass in the transaction identifier provided by Apple to avoid duplicate revenue tracking. It should look roughly like this: @@ -36,14 +36,14 @@ all adjust SDK calls. ![][rename] -3. Download version v3.3.0 and drag the new folder `Adjust` into your Xcode +3. Download version v3.3.1 and drag the new folder `Adjust` into your Xcode Project Navigator. ![][drag] 4. Build your project to confirm that everything is properly connected again. -The adjust SDK v3.3.0 added delegate callbacks. Check out the [README] for +The adjust SDK v3.3.1 added delegate callbacks. Check out the [README] for details. @@ -99,7 +99,7 @@ meaningful at all times! Especially if you are tracking revenue. 1. The `appDidLaunch` method now expects your App Token instead of your App ID. You can find your App Token in your [dashboard]. -2. The adjust SDK for iOS 3.3.0 uses [ARC][arc]. If you haven't done already, +2. The adjust SDK for iOS 3.3.1 uses [ARC][arc]. If you haven't done already, we recommend [transitioning your project to use ARC][transition] as well. If you don't want to use ARC, you have to enable ARC for all files of the adjust SDK. Please consult the [README] for details.