Skip to content

Commit fc3816c

Browse files
committed
sdk fixes:
- update swift_version = 4.2 - changed http method for hit.gif request from POST to GET - do not send hit.gif request if no kitTcode
1 parent b5a3f0b commit fc3816c

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Platform](https://img.shields.io/cocoapods/p/UserReport.svg?style=flat)](http://cocoadocs.org/docsets/UserReport)
55
![Xcode 9.0](https://img.shields.io/badge/Xcode-9.0-blue.svg)
66
![iOS 9.0+](https://img.shields.io/badge/iOS-9.0%2B-blue.svg)
7-
![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg)
7+
![Swift 4.2](https://img.shields.io/badge/Swift-4.2-orange.svg)
88
[![License](https://img.shields.io/cocoapods/l/UserReport.svg)](https://raw.githubusercontent.com/AudienceProject/userreport-ios-sdk/master/LICENSE)
99

1010

UserReport.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,5 @@ Pod::Spec.new do |s|
121121
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
122122
# s.dependency "JSONKit", "~> 1.4"
123123

124+
s.swift_version = '4.2'
124125
end

UserReport/UserReport/Network/Network.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,18 @@ internal class Network {
8282
func audiences(info: Info, completion: @escaping ((Result<Empty>) -> Void)) {
8383
//https://visitanalytics.userreport.com/hit.gif?t=[kitTcode]&rnd=%RANDOM%&d=IDFA&med=app_name
8484
let appName = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String
85-
let kitTcode = info.mediaSettings?.kitTcode
86-
let tCode = (kitTcode != nil) ? "t=\(kitTcode!)&" : ""
85+
86+
guard let kitTcode = info.mediaSettings?.kitTcode else {
87+
return
88+
}
89+
90+
let tCode = "t=\(kitTcode)&"
8791
let random = arc4random_uniform(UInt32.max)
8892
let idfa = info.user?.idfa ?? ""
8993
let url = URL(string: "\(self.server.audiences)/hit.gif?\(tCode)rnd=\(random)&d=\(idfa)&med=\(appName)")
9094
self.userAgent { (userAgent) in
9195
let headers = ["User-Agent": userAgent]
92-
self.sendRequest(httpMethod: HTTPMethod.POST, url: url, headers: headers, body: nil, emptyReponse: true, completion: completion)
96+
self.sendRequest(httpMethod: HTTPMethod.GET, url: url, headers: headers, body: nil, emptyReponse: true, completion: completion)
9397
}
9498
}
9599

0 commit comments

Comments
 (0)