Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.33.2 #644

Merged
merged 16 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Adjust.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "Adjust"
s.version = "4.33.1"
s.version = "4.33.2"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "https://github.com/adjust/ios_sdk"
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
s.author = { "Adjust GmbH" => "sdk@adjust.com" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.33.1" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.33.2" }
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
12 changes: 7 additions & 5 deletions Adjust/ADJActivityHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ - (id)initWithConfig:(ADJConfig *)adjustConfig
[self readActivityState];

// register SKAdNetwork attribution if we haven't already
[[ADJSKAdNetwork getInstance] adjRegisterWithCompletionHandler:^(NSError * _Nonnull error) {
if (error) {
// handle error
}
}];
if (self.adjustConfig.isSKAdNetworkHandlingActive) {
[[ADJSKAdNetwork getInstance] adjRegisterWithCompletionHandler:^(NSError * _Nonnull error) {
if (error) {
// handle error
}
}];
}

self.internalState = [[ADJInternalState alloc] init];

Expand Down
95 changes: 66 additions & 29 deletions Adjust/ADJSKAdNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
@interface ADJSKAdNetwork()

@property (nonatomic, weak) id<ADJLogger> logger;
@property (nonatomic, strong) Class clsSkAdNetwork;
@property (nonatomic, assign) SEL selRegisterAppForAdNetworkAttribution;
@property (nonatomic, assign) SEL selUpdateConversionValue;
@property (nonatomic, assign) SEL selUpdatePostbackConversionValueCompletionHandler;
@property (nonatomic, assign) SEL selUpdatePostbackConversionValueCoarseValueCompletionHandler;
@property (nonatomic, assign) SEL selUpdatePostbackConversionValueCoarseValueLockWindowCompletionHandler;

@end

Expand All @@ -45,34 +39,41 @@ - (instancetype)init {
}

self.logger = [ADJAdjustFactory logger];
self.clsSkAdNetwork = NSClassFromString(@"SKAdNetwork");
self.selRegisterAppForAdNetworkAttribution = NSSelectorFromString(@"registerAppForAdNetworkAttribution");
self.selUpdateConversionValue = NSSelectorFromString(@"updateConversionValue:");
self.selUpdatePostbackConversionValueCompletionHandler = NSSelectorFromString(@"updatePostbackConversionValue:completionHandler:");
self.selUpdatePostbackConversionValueCoarseValueCompletionHandler = NSSelectorFromString(@"updatePostbackConversionValue:coarseValue:completionHandler:");
self.selUpdatePostbackConversionValueCoarseValueLockWindowCompletionHandler = NSSelectorFromString(@"updatePostbackConversionValue:coarseValue:lockWindow:completionHandler:");

return self;
}

#pragma mark - SKAdNetwork API

- (void)registerAppForAdNetworkAttribution {
Class class = [self getSKAdNetworkClass];
SEL selector = NSSelectorFromString(@"registerAppForAdNetworkAttribution");
if (@available(iOS 14.0, *)) {
if ([self isStoreKitAvailable]) {
((id (*)(id, SEL))[self.clsSkAdNetwork methodForSelector:self.selRegisterAppForAdNetworkAttribution])(self.clsSkAdNetwork, self.selRegisterAppForAdNetworkAttribution);
[self.logger debug:@"Called SKAdNetwork's registerAppForAdNetworkAttribution method"];
if ([self isApiAvailableForClass:class andSelector:selector]) {
NSMethodSignature *methodSignature = [class methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[invocation setSelector:selector];
[invocation setTarget:class];
[invocation invoke];
[self.logger verbose:@"Call to SKAdNetwork's registerAppForAdNetworkAttribution method made"];
}
} else {
[self.logger warn:@"SKAdNetwork's registerAppForAdNetworkAttribution method not available for this operating system version"];
}
}

- (void)updateConversionValue:(NSInteger)conversionValue {
Class class = [self getSKAdNetworkClass];
SEL selector = NSSelectorFromString(@"updateConversionValue:");
if (@available(iOS 14.0, *)) {
if ([self isStoreKitAvailable]) {
((id (*)(id, SEL, NSInteger))[self.clsSkAdNetwork methodForSelector:self.selUpdateConversionValue])(self.clsSkAdNetwork, self.selUpdateConversionValue, conversionValue);
[self.logger verbose:@"Called SKAdNetwork's updateConversionValue: method made with conversion value: %d", conversionValue];
if ([self isApiAvailableForClass:class andSelector:selector]) {
NSMethodSignature *methodSignature = [class methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[invocation setSelector:selector];
[invocation setTarget:class];
[invocation setArgument:&conversionValue atIndex:2];
[invocation invoke];
[self.logger verbose:@"Call to SKAdNetwork's updateConversionValue: method made with value %d", conversionValue];
}
} else {
[self.logger warn:@"SKAdNetwork's updateConversionValue: method not available for this operating system version"];
Expand All @@ -81,10 +82,17 @@ - (void)updateConversionValue:(NSInteger)conversionValue {

- (void)updatePostbackConversionValue:(NSInteger)conversionValue
completionHandler:(void (^)(NSError *error))completion {
Class class = [self getSKAdNetworkClass];
SEL selector = NSSelectorFromString(@"updatePostbackConversionValue:completionHandler:");
if (@available(iOS 15.4, *)) {
if ([self isStoreKitAvailable]) {
((id (*)(id, SEL, NSInteger, void (^)(NSError *error)))[self.clsSkAdNetwork methodForSelector:self.selUpdatePostbackConversionValueCompletionHandler])(self.clsSkAdNetwork, self.selUpdatePostbackConversionValueCompletionHandler, conversionValue, completion);
// call is made, success / failure will be checked and logged inside of the completion block
if ([self isApiAvailableForClass:class andSelector:selector]) {
NSMethodSignature *methodSignature = [class methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[invocation setSelector:selector];
[invocation setTarget:class];
[invocation setArgument:&conversionValue atIndex:2];
[invocation setArgument:&completion atIndex:3];
[invocation invoke];
}
} else {
[self.logger warn:@"SKAdNetwork's updatePostbackConversionValue:completionHandler: method not available for this operating system version"];
Expand All @@ -94,10 +102,18 @@ - (void)updatePostbackConversionValue:(NSInteger)conversionValue
- (void)updatePostbackConversionValue:(NSInteger)fineValue
coarseValue:(NSString *)coarseValue
completionHandler:(void (^)(NSError *error))completion {
Class class = [self getSKAdNetworkClass];
SEL selector = NSSelectorFromString(@"updatePostbackConversionValue:coarseValue:completionHandler:");
if (@available(iOS 16.1, *)) {
if ([self isStoreKitAvailable]) {
((id (*)(id, SEL, NSInteger, NSString *, void (^)(NSError *error)))[self.clsSkAdNetwork methodForSelector:self.selUpdatePostbackConversionValueCoarseValueCompletionHandler])(self.clsSkAdNetwork, self.selUpdatePostbackConversionValueCoarseValueCompletionHandler, fineValue, coarseValue, completion);
// call is made, success / failure will be checked and logged inside of the completion block
if ([self isApiAvailableForClass:class andSelector:selector]) {
NSMethodSignature *methodSignature = [class methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[invocation setSelector:selector];
[invocation setTarget:class];
[invocation setArgument:&fineValue atIndex:2];
[invocation setArgument:&coarseValue atIndex:3];
[invocation setArgument:&completion atIndex:4];
[invocation invoke];
}
} else {
[self.logger warn:@"SKAdNetwork's updatePostbackConversionValue:coarseValue:completionHandler: method not available for this operating system version"];
Expand All @@ -108,10 +124,19 @@ - (void)updatePostbackConversionValue:(NSInteger)fineValue
coarseValue:(NSString *)coarseValue
lockWindow:(BOOL)lockWindow
completionHandler:(void (^)(NSError *error))completion {
Class class = [self getSKAdNetworkClass];
SEL selector = NSSelectorFromString(@"updatePostbackConversionValue:coarseValue:lockWindow:completionHandler:");
if (@available(iOS 16.1, *)) {
if ([self isStoreKitAvailable]) {
((id (*)(id, SEL, NSInteger, NSString *, BOOL, void (^)(NSError *error)))[self.clsSkAdNetwork methodForSelector:self.selUpdatePostbackConversionValueCoarseValueLockWindowCompletionHandler])(self.clsSkAdNetwork, self.selUpdatePostbackConversionValueCoarseValueLockWindowCompletionHandler, fineValue, coarseValue, lockWindow, completion);
// call is made, success / failure will be checked and logged inside of the completion block
if ([self isApiAvailableForClass:class andSelector:selector]) {
NSMethodSignature *methodSignature = [class methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[invocation setSelector:selector];
[invocation setTarget:class];
[invocation setArgument:&fineValue atIndex:2];
[invocation setArgument:&coarseValue atIndex:3];
[invocation setArgument:&lockWindow atIndex:4];
[invocation setArgument:&completion atIndex:5];
[invocation invoke];
}
} else {
[self.logger warn:@"SKAdNetwork's updatePostbackConversionValue:coarseValue:lockWindow:completionHandler: method not available for this operating system version"];
Expand Down Expand Up @@ -172,11 +197,19 @@ - (void)adjUpdateConversionValue:(NSInteger)conversionValue

#pragma mark - Private

- (BOOL)isStoreKitAvailable {
if (self.clsSkAdNetwork == nil) {
- (BOOL)isApiAvailableForClass:(Class)class andSelector:(SEL)selector {
if (class == nil) {
[self.logger warn:@"StoreKit.framework not found in the app (SKAdNetwork class not found)"];
return NO;
}
if (!selector) {
[self.logger warn:@"Selector for given method was not found"];
return NO;
}
if ([class respondsToSelector:selector] == NO) {
[self.logger warn:@"%@ method implementation not found", NSStringFromSelector(selector)];
return NO;
}
return YES;
}

Expand Down Expand Up @@ -204,4 +237,8 @@ - (NSString *)getSkAdNetworkCoarseConversionValue:(NSString *)adjustCoarseValue
}
}

- (Class)getSKAdNetworkClass {
return NSClassFromString(@"SKAdNetwork");
}

@end
2 changes: 1 addition & 1 deletion Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
static NSRegularExpression *shortUniversalLinkRegex = nil;
static NSRegularExpression *excludedDeeplinkRegex = nil;

static NSString * const kClientSdk = @"ios4.33.1";
static NSString * const kClientSdk = @"ios4.33.2";
static NSString * const kDeeplinkParam = @"deep_link=";
static NSString * const kSchemeDelimiter = @"://";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
Expand Down
2 changes: 1 addition & 1 deletion Adjust/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust SDK
//
// V4.33.1
// V4.33.2
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion AdjustBridge/AdjustBridgeRegister.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ + (NSString *)adjust_js {
if (this.sdkPrefix) {
return this.sdkPrefix;
} else {
return 'web-bridge4.33.1';
return 'web-bridge4.33.2';
}
},
setTestOptions: function(testOptions) {
Expand Down
2 changes: 1 addition & 1 deletion AdjustTests/AdjustUnitTests/ADJPackageFields.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ - (id) init {

// default values
self.appToken = @"qwerty123456";
self.clientSdk = @"ios4.33.1";
self.clientSdk = @"ios4.33.2";
self.suffix = @"";
self.environment = @"sandbox";

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
### Version 4.33.2 (6th December 2022)
#### Fixed
- Added additional checks to make sure that non-existing selectors for given platform don't attempt to be executed (https://github.com/adjust/ios_sdk/issues/641).

---

### Version 4.33.1 (28th November 2022)
#### Added
- Added support for setting a new China URL Strategy. You can choose this setting by calling `setUrlStrategy:` method of `ADJConfig` instance with `ADJUrlStrategyCn` parameter.
- Added support to `convertUniversalLink:scheme:` method to be able to parse data residency universal links.

---

### Version 4.33.0 (November 19th 2021)
### Version 4.33.0 (November 19th 2022)
#### Added
- Added support for SKAdNetwork 4.0.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.33.1
4.33.2
56 changes: 44 additions & 12 deletions scripts/build_definitions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,32 @@ Usage: $0 [options]
XCF_FRM_ZIP_NAME__WEB_BRIDGE_DYNAMIC="AdjustSdk-WebBridge-Dynamic"
XCF_FRM_ZIP_NAME__WEB_BRIDGE_STATIC="AdjustSdk-WebBridge-Static"

# Xcode version impacts the way we build frameworks
XCODE12PLUS=0
XCODE14PLUS=0
product_version=$(xcodebuild -version)
xcode_version=( ${product_version//./ } )
xcode="${xcode_version[0]}"
major="${xcode_version[1]}"
minor="${xcode_version[2]}"
echo "${xcode}.${major}.${minor}"
if [[ $major > 11 ]]; then
XCODE12PLUS=1
fi
if [[ $major > 13 ]]; then
XCODE14PLUS=1
fi

SDK_VERSION=$(head -n 1 VERSION)
echo "$SDK_VERSION"

# previous builds artefacts cleanup
rm -rf ${XCF_OUTPUT_FOLDER}
mkdir ${XCF_OUTPUT_FOLDER}

# previous xcode build folder cleanup
xcodebuild clean

function build_archive() {
# Prameters:
# 1 - scheme name
Expand Down Expand Up @@ -220,12 +241,14 @@ Usage: $0 [options]
# 1 - Archive name
# 2 - Archive location folder
#echo "XCFramework: Generating BCSymbolMap paths command from $1 ..."

BCSYMBOLMAP_PATHS=("$(pwd -P)"/$2/$1.xcarchive/BCSymbolMaps/*)
BCSYMBOLMAP_COMMANDS=""
for path in "${BCSYMBOLMAP_PATHS[@]}"; do
BCSYMBOLMAP_COMMANDS="$BCSYMBOLMAP_COMMANDS -debug-symbols $path "
done
BCSYMBOLMAP_PATHS=" "
if [[ $XCODE14PLUS == 0 ]]; then
BCSYMBOLMAP_PATHS=("$(pwd -P)"/$2/$1.xcarchive/BCSymbolMaps/*)
BCSYMBOLMAP_COMMANDS=""
for path in "${BCSYMBOLMAP_PATHS[@]}"; do
BCSYMBOLMAP_COMMANDS="$BCSYMBOLMAP_COMMANDS -debug-symbols $path "
done
fi
echo $BCSYMBOLMAP_COMMANDS
}

Expand Down Expand Up @@ -286,12 +309,21 @@ Usage: $0 [options]
xcodebuild clean

if [[ $os == "ios" ]]; then

xcodebuild -configuration Release \
-target "$target_scheme" \
-sdk iphonesimulator \
-arch x86_64 -arch i386 \
build

if [[ $XCODE14PLUS > 0 ]]; then
# Xcode14 dropped 32-bit support, so we have to drop 'i386' arc.
xcodebuild -configuration Release \
-target "$target_scheme" \
-sdk iphonesimulator \
-arch x86_64 \
build
else
xcodebuild -configuration Release \
-target "$target_scheme" \
-sdk iphonesimulator \
-arch x86_64 -arch i386 \
build
fi

xcodebuild -configuration Release \
-target "$target_scheme" \
Expand Down
5 changes: 4 additions & 1 deletion scripts/static_xcframeworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ then
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} XCFramework: Buiding Static XCFramework for ${TRAGET_PLATFORM_DESCRIPTION} ...${NC}"
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =${NC}"

xcodebuild clean

if [[ $BUILD_TARGET_IOS -eq 1 ]]
then
Expand Down Expand Up @@ -109,6 +110,8 @@ then
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} XCFramework: Buiding Static XCFramework for iOS (iMessage)...${NC}"
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =${NC}"

xcodebuild clean

xcodebuild -configuration Release \
-target ${SCHEMA_NAME__ADJUST_IM_STATIC} \
-sdk iphonesimulator \
Expand Down Expand Up @@ -137,7 +140,7 @@ fi
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

if [[ $BUILD_TARGET_WEB_BRIDGE -eq 1 ]]
then
then
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =${NC}"
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} XCFramework: Buiding Static XCFramework for iOS (WebBridge)...${NC}"
echo -e "${CYAN}[ADJUST][BUILD]:${GREEN} = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =${NC}"
Expand Down