Skip to content
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.2.0"
s.version = "4.2.1"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "http://adjust.com"
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
s.author = { "Christian Wellenbrock" => "welle@adjust.com" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.2.0" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.2.1" }
s.platform = :ios, '4.3'
s.framework = 'SystemConfiguration'
s.weak_framework = 'AdSupport', 'iAd'
Expand Down
2 changes: 1 addition & 1 deletion Adjust/ADJAdditions/NSData+ADJAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

- (NSString *)adjEncodeBase64;

@end
@end
2 changes: 1 addition & 1 deletion Adjust/ADJAdditions/NSData+ADJAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ - (NSString *)adjEncodeBase64 {
return encodedString;
}

@end
@end
10 changes: 5 additions & 5 deletions Adjust/ADJAttributionHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,23 @@ -(void) getAttributionInternal {
NSError *requestError;
NSURLResponse *urlResponse = nil;

NSData *response = [NSURLConnection sendSynchronousRequest:request
NSData *responseData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&urlResponse
error:&requestError];
// connection error
if (requestError != nil) {
if (responseData == nil || requestError != nil) {
[self.logger error:@"Failed to get attribution. (%@)", requestError.localizedDescription];
return;
}

NSString *responseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] adjTrim];
NSInteger statusCode = ((NSHTTPURLResponse*)urlResponse).statusCode;
[self.logger verbose:@"status code %d for attribution response: %@", statusCode, responseString];

NSDictionary *jsonDict = [ADJUtil buildJsonDict:responseString];
NSDictionary *jsonDict = [ADJUtil buildJsonDict:responseData];

if (jsonDict == nil || jsonDict == (id)[NSNull null]) {
[self.logger error:@"Failed to parse json attribution response: %@", responseString.adjTrim];
[self.logger error:@"Failed to parse json attribution response: %@", responseString];
return;
}

Expand Down
10 changes: 5 additions & 5 deletions Adjust/ADJRequestHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ - (void)sendInternal:(ADJActivityPackage *)package sendToPackageHandler:(BOOL)se
NSMutableURLRequest *request = [self requestForPackage:package];
NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request
NSData *responseData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&error];

// connection error
if (error != nil) {
if (responseData == nil || error != nil) {
[self.logger error:@"%@. (%@) Will retry later.", package.failureMessage, error.localizedDescription];
[self.packageHandler finishedTrackingActivity:nil];
if (sendToPackageHandler) {
Expand All @@ -81,15 +81,15 @@ - (void)sendInternal:(ADJActivityPackage *)package sendToPackageHandler:(BOOL)se
return;
}

NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] adjTrim];
NSInteger statusCode = response.statusCode;

[self.logger verbose:@"status code %d for package response: %@", statusCode, responseString];

NSDictionary *jsonDict = [ADJUtil buildJsonDict:responseString];
NSDictionary *jsonDict = [ADJUtil buildJsonDict:responseData];

if (jsonDict == nil || jsonDict == (id)[NSNull null]) {
[self.logger error:@"Failed to parse json response. (%@) Will retry later.", responseString.adjTrim];
[self.logger error:@"Failed to parse json response. (%@) Will retry later.", responseString];
if (sendToPackageHandler) {
[self.packageHandler closeFirstPackage];
}
Expand Down
2 changes: 1 addition & 1 deletion Adjust/ADJUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
+ (void)excludeFromBackup:(NSString *)filename;
+ (NSString *)formatSeconds1970:(double)value;
+ (NSString *)formatDate:(NSDate *)value;
+ (NSDictionary *) buildJsonDict:(NSString *)jsonString;
+ (NSDictionary *) buildJsonDict:(NSData *)jsonData;

+ (NSString *)getFullFilename:(NSString *) baseFilename;

Expand Down
17 changes: 12 additions & 5 deletions Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <sys/xattr.h>

static NSString * const kBaseUrl = @"https://app.adjust.com";
static NSString * const kClientSdk = @"ios4.2.0";
static NSString * const kClientSdk = @"ios4.2.1";

static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'Z";
static NSDateFormatter *dateFormat;
Expand Down Expand Up @@ -69,7 +69,7 @@ + (void)excludeFromBackup:(NSString *)path {
BOOL success = [url setResourceValue:[NSNumber numberWithBool:YES]
forKey:NSURLIsExcludedFromBackupKey
error:&error];
if (!success) {
if (!success || error != nil) {
[logger debug:@"Failed to exclude '%@' from backup (%@)", url.lastPathComponent, error.localizedDescription];
}
}
Expand All @@ -89,10 +89,17 @@ + (NSString *)formatDate:(NSDate *) value {
}


+ (NSDictionary *)buildJsonDict:(NSString *)jsonString {
+ (NSDictionary *)buildJsonDict:(NSData *)jsonData {
if (jsonData == nil) {
return nil;
}
NSError *error = nil;
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
NSDictionary *jsonDict = nil;
@try {
jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
} @catch (NSException *ex) {
return nil;
}

if (error != nil) {
return nil;
Expand Down
2 changes: 1 addition & 1 deletion AdjustTests/ADJActivityHandlerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ - (void)testFirstRun
ADJActivityPackage *activityPackage = (ADJActivityPackage *) self.packageHandlerMock.packageQueue[0];

// check the Sdk version is being tested
XCTAssertEqual(@"ios4.2.0", activityPackage.clientSdk, @"%@", activityPackage.extendedString);
XCTAssertEqual(@"ios4.2.1", activityPackage.clientSdk, @"%@", activityPackage.extendedString);

// check the server url
XCTAssertEqual(@"https://app.adjust.com", ADJUtil.baseUrl);
Expand Down
4 changes: 2 additions & 2 deletions AdjustTests/ADJAttributionHandlerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ -(void) testAskInConnectionError {

[NSURLConnection setConnectionError:YES];

NSDictionary *jsonDict = [ADJUtil buildJsonDict:@"{\"attribution\":{\"tracker_token\":\"trackerTokenValue\",\"tracker_name\":\"trackerNameValue\",\"network\":\"networkValue\",\"campaign\":\"campaignValue\",\"adgroup\":\"adgroupValue\",\"creative\":\"creativeValue\",\"click_label\":\"clickLabelValue\"},\"ask_in\":0,\"message\":\"response OK\",\"deeplink\":\"testApp://\"}"];
NSDictionary *jsonDict = [ADJUtil buildJsonDict:[@"{\"attribution\":{\"tracker_token\":\"trackerTokenValue\",\"tracker_name\":\"trackerNameValue\",\"network\":\"networkValue\",\"campaign\":\"campaignValue\",\"adgroup\":\"adgroupValue\",\"creative\":\"creativeValue\",\"click_label\":\"clickLabelValue\"},\"ask_in\":0,\"message\":\"response OK\",\"deeplink\":\"testApp://\"}" dataUsingEncoding:NSUTF8StringEncoding]];

[attributionHandler checkAttribution:jsonDict];

Expand Down Expand Up @@ -297,7 +297,7 @@ -(void) testCancelTimer {

NSString * jsonString = @"{\"attribution\":{\"tracker_token\":\"trackerTokenValue\",\"tracker_name\":\"trackerNameValue\",\"network\":\"networkValue\",\"campaign\":\"campaignValue\",\"adgroup\":\"adgroupValue\",\"creative\":\"creativeValue\",\"click_label\":\"clickLabelValue\"},\"message\":\"response OK\",\"ask_in\":\"5000\"}";

NSDictionary * jsonDict = [ADJUtil buildJsonDict:jsonString];
NSDictionary * jsonDict = [ADJUtil buildJsonDict:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];

[attributionHandler checkAttribution:jsonDict];

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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 => 'v4.2.0'
pod 'Adjust', :git => 'git://github.com/adjust/ios_sdk.git', :tag => 'v4.2.1'
```

### 1. Get the SDK
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0
4.2.1
2 changes: 1 addition & 1 deletion doc/migrate.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Migrate your adjust SDK for iOS to v4.2.0 from v3.4.0
## Migrate your adjust SDK for iOS to v4.2.1 from v3.4.0

### Initial setup

Expand Down