Skip to content

Commit 803b8fc

Browse files
authored
Support tvOS (#90)
- Add support to tvOS - Update KeenClientTD to 3.3.0 - Add TVOS example app - Update CircleCI config to support CircleCI 2.0 and `commands` feature
1 parent 4466d90 commit 803b8fc

File tree

51 files changed

+1795
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1795
-189
lines changed

.circleci/config.yml

+142-133
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,182 @@
1-
version: 2
2-
3-
_defaults:
4-
5-
- &auxiliary_setup
6-
run:
7-
name: Auxiliary setup
8-
command: |
9-
gem install xcpretty --user-install
10-
HOMEBREW_NO_AUTO_UPDATE=1 brew install gnu-sed # for ci_test script
11-
mkdir logs test_results
12-
13-
- &restore_pods_cache
14-
restore_cache:
15-
name: Restore Pods cache
16-
keys:
17-
- v3-pods-{{ checksum "Podfile.lock" }}
18-
19-
- &install_pods
20-
run:
21-
name: Install Pods
22-
command: ./scripts/ci_pod_install
23-
24-
- &save_pods_cache
25-
save_cache:
26-
name: Saving Pods cache
27-
key: v3-pods-{{ checksum "Podfile.lock" }}
28-
paths:
29-
- Pods
30-
- TreasureData.xcworkspace
31-
32-
- &store_artifacts
33-
store_artifacts:
34-
path: ./logs
35-
destination: logs
36-
37-
- &store_test_results
38-
store_test_results:
39-
path: ./test_results
40-
41-
- &ios9_install_and_workaround
42-
run:
43-
name: iOS 9 Install and Workaround
44-
command: |
45-
xcversion simulators --install='iOS 9.3' --no-progress
46-
sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'
47-
48-
- &ios8_install_and_workaround
49-
run:
50-
name: iOS 8 Install and Workaround
51-
command: |
52-
xcversion simulators --install='iOS 8.4' --no-progress
53-
sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'
1+
version: 2.1
2+
3+
4+
commands:
5+
auxiliary_setup:
6+
description: "Various setup before running tests"
7+
steps:
8+
- run:
9+
name: Auxiliary setup
10+
command: |
11+
gem install xcpretty --user-install
12+
HOMEBREW_NO_AUTO_UPDATE=1 brew install gnu-sed # for ci_test script
13+
mkdir logs test_results
14+
15+
install_cocoapods:
16+
description: "Command to install and cache Cocoapods"
17+
steps:
18+
- restore_cache:
19+
key: 1-gems-{{ checksum "Gemfile.lock" }}
20+
- run: bundle check || bundle install --path vendor/bundle --clean
21+
- save_cache:
22+
key: 1-gems-{{ checksum "Gemfile.lock" }}
23+
paths:
24+
- vendor/bundle
25+
26+
install_pods:
27+
description: "Command to install and cache pods"
28+
steps:
29+
- restore_cache:
30+
name: Restore Pods cache
31+
keys:
32+
- v3-pods-{{ checksum "Podfile.lock" }}
33+
- run:
34+
name: Install Pods
35+
command: ./scripts/ci_pod_install
36+
- save_cache:
37+
name: Saving Pods cache
38+
key: v3-pods-{{ checksum "Podfile.lock" }}
39+
paths:
40+
- Pods
41+
- TreasureData.xcworkspace
42+
43+
run_tests:
44+
description: ""
45+
parameters:
46+
version_name:
47+
type: "string"
48+
os:
49+
type: "string"
50+
simulator:
51+
type: "string"
52+
default: "iphone 11"
53+
no_output_timeout:
54+
type: integer
55+
default: 1800
56+
steps:
57+
- run:
58+
name: Test on iOS <<parameters.version_name>>
59+
no_output_timeout: <<parameters.no_output_timeout>>
60+
command: ./scripts/ci_test 'platform=iOS Simulator,name=<<parameters.simulator>>,OS=<<parameters.os>>' logs/xcbuild_ios_<<parameters.version_name>>.log test_results/ios_<<parameters.version_name>>.xml
61+
62+
store_results:
63+
description: "Command to store artifacts and test results"
64+
steps:
65+
- store_artifacts:
66+
path: ./logs
67+
destination: logs
68+
- store_test_results:
69+
path: ./test_results
70+
71+
ios9_install_and_workaround:
72+
description: "Command for iOS 9 workaround"
73+
steps:
74+
- run:
75+
name: iOS 9 Install and Workaround
76+
command: |
77+
xcversion simulators --install='iOS 9.3' --no-progress
78+
sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'
79+
80+
ios8_install_and_workaround:
81+
description: "Command for iOS 8 workaround"
82+
steps:
83+
- run:
84+
name: iOS 8 Install and Workaround
85+
command: |
86+
xcversion simulators --install='iOS 8.4' --no-progress
87+
sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'
88+
89+
run_tests_flow:
90+
description: "Single flow for running tests targetting specified iOS"
91+
parameters:
92+
version_name:
93+
type: "string"
94+
os:
95+
type: "string"
96+
simulator:
97+
type: "string"
98+
default: "iphone 11"
99+
no_output_timeout:
100+
type: integer
101+
default: 1800
102+
steps:
103+
- checkout
104+
- auxiliary_setup
105+
- install_cocoapods
106+
- install_pods
107+
- run_tests:
108+
version_name: <<parameters.version_name>>
109+
os: <<parameters.os>>
110+
simulator: <<parameters.simulator>>
111+
- store_results
112+
54113

55114
jobs:
56115
test_ios14:
57116
macos:
58117
xcode: "12.0.0"
59118
steps:
60-
- checkout
61-
- *auxiliary_setup
62-
- *restore_pods_cache
63-
- *install_pods
64-
- *save_pods_cache
65-
- run:
66-
name: Test on iOS 14
67-
no_output_timeout: 1800
68-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 11,OS=14.0' logs/xcbuild_ios_14.log test_results/ios_14.xml
69-
- *store_artifacts
70-
- *store_test_results
71-
119+
- run_tests_flow:
120+
version_name: "14"
121+
os: "14.0"
122+
simulator: "iPhone 11"
72123

73124
test_ios13:
74125
macos:
75126
xcode: "11.6.0"
76127
steps:
77-
- checkout
78-
- *auxiliary_setup
79-
- *restore_pods_cache
80-
- *install_pods
81-
- *save_pods_cache
82-
- run:
83-
name: Test on iOS 13
84-
no_output_timeout: 1800
85-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 11,OS=13.6' logs/xcbuild_ios_13.log test_results/ios_13.xml
86-
- *store_artifacts
87-
- *store_test_results
128+
- run_tests_flow:
129+
version_name: "13"
130+
os: "13.6"
131+
simulator: "iPhone 11"
88132

89133
test_ios12:
90134
macos:
91135
xcode: "10.2.1"
92136
steps:
93-
- checkout
94-
- *auxiliary_setup
95-
- *restore_pods_cache
96-
- *install_pods
97-
- *save_pods_cache
98-
- run:
99-
name: Test on iOS 12
100-
no_output_timeout: 1800
101-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 7,OS=12.2' logs/xcbuild_ios_12.log test_results/ios_12.xml
102-
- *store_artifacts
103-
- *store_test_results
137+
- run_tests_flow:
138+
version_name: "12"
139+
os: "12.2"
140+
simulator: "iPhone 7"
104141

105142
test_ios11:
106143
macos:
107144
xcode: "10.2.1"
108145
steps:
109-
- checkout
110-
- *auxiliary_setup
111-
- *restore_pods_cache
112-
- *install_pods
113-
- *save_pods_cache
114-
- run:
115-
name: Test on iOS 11
116-
no_output_timeout: 1800
117-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 7,OS=11.4' logs/xcbuild_ios_10.log test_results/ios_10.xml
118-
- *store_artifacts
119-
- *store_test_results
146+
- run_tests_flow:
147+
version_name: "11"
148+
os: "11.4"
149+
simulator: "iPhone 7"
120150

121151
test_ios10:
122152
macos:
123153
xcode: "10.2.1"
124154

125155
steps:
126-
- checkout
127-
- *auxiliary_setup
128-
- *restore_pods_cache
129-
- *install_pods
130-
- *save_pods_cache
131-
- run:
132-
name: Test on iOS 10
133-
no_output_timeout: 1800
134-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 7,OS=10.3.1' logs/xcbuild_ios_10.log test_results/ios_10.xml
135-
- *store_artifacts
136-
- *store_test_results
156+
- run_tests_flow:
157+
version_name: "10"
158+
os: "10.3.1"
159+
simulator: "iPhone 7"
137160

138161
test_ios9:
139162
macos:
140163
xcode: "10.2.1"
141164
steps:
142-
- checkout
143-
- *ios9_install_and_workaround
144-
- *auxiliary_setup
145-
- *restore_pods_cache
146-
- *install_pods
147-
- *save_pods_cache
148-
- run:
149-
name: Test on iOS 9
150-
no_output_timeout: 1800
151-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 6s,OS=9.3' logs/xcbuild_ios_9.log test_results/ios_9.xml
152-
- *store_artifacts
153-
- *store_test_results
165+
- ios9_install_and_workaround
166+
- run_tests_flow:
167+
version_name: "9"
168+
os: "9.3"
169+
simulator: "iPhone 6s"
154170

155171
test_ios8:
156172
macos:
157173
xcode: "10.2.1"
158174
steps:
159-
- checkout
160-
- *ios8_install_and_workaround
161-
- *auxiliary_setup
162-
- *restore_pods_cache
163-
- *install_pods
164-
- *save_pods_cache
165-
- run:
166-
name: Test on iOS 8
167-
no_output_timeout: 1800
168-
command: ./scripts/ci_test 'platform=iOS Simulator,name=iPhone 6,OS=8.4' logs/xcbuild_ios_8.log test_results/ios_8.xml
169-
- *store_artifacts
170-
- *store_test_results
175+
- ios8_install_and_workaround
176+
- run_tests_flow:
177+
version_name: "8"
178+
os: "8.4"
179+
simulator: "iPhone 6"
171180

172181

173182
workflows:

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source 'https://rubygems.org'
22

33
gem "rake"
4-
gem "cocoapods", '= 1.1.1'
4+
gem "cocoapods", '= 1.9.3'

Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
platform :ios, '7.0'
22

33
target 'TreasureData' do
4-
pod 'KeenClientTD', '= 3.2.35'
4+
pod 'KeenClientTD', '= 3.3.0'
55
end
66

77
target 'TreasureDataTests' do

Podfile.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
PODS:
2-
- KeenClientTD (3.2.35):
3-
- KeenClientTD/keen_sqlite (= 3.2.35)
4-
- KeenClientTD/keen_sqlite (3.2.35)
2+
- KeenClientTD (3.3.0):
3+
- KeenClientTD/keen_sqlite (= 3.3.0)
4+
- KeenClientTD/keen_sqlite (3.3.0)
55

66
DEPENDENCIES:
7-
- KeenClientTD (= 3.2.35)
7+
- KeenClientTD (= 3.3.0)
88

99
SPEC REPOS:
10-
https://github.com/cocoapods/specs.git:
10+
https://cdn.cocoapods.org/:
1111
- KeenClientTD
1212

1313
SPEC CHECKSUMS:
14-
KeenClientTD: dc8f7d3948b650b6c04a3be73f947bb757467efd
14+
KeenClientTD: 0e0399a8e5030890ace84644cea0bd39463c3ad4
1515

16-
PODFILE CHECKSUM: 7148f57bcf4b8488673f52ee710cf2de23769865
16+
PODFILE CHECKSUM: 1f896df3bc3ce253b645f6fffc7b165c2819c6b7
1717

18-
COCOAPODS: 1.7.5
18+
COCOAPODS: 1.9.3

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Treasure Data iOS SDK
22
===============
33

4-
iOS SDK for [Treasure Data](http://www.treasuredata.com/). With this SDK, you can import the events on your applications into Treasure Data easily. Technically, this library supports iOS 7 and later, but we only execute OS coverage tests for iOS 8, 9, 10, 11, 12, 13 and 14.
4+
iOS and tvOS SDK for [Treasure Data](http://www.treasuredata.com/). With this SDK, you can import the events on your applications into Treasure Data easily. Technically, this library supports iOS 7 and later, but we only execute OS coverage tests for iOS 8, 9, 10, 11, 12, 13 and 14. This SDK also support Apple tvOS 12 and up.
55

66
Also, there is an alternative SDK written in Swift [https://github.com/recruit-lifestyle/TreasureDataSDK](https://github.com/recruit-lifestyle/TreasureDataSDK). Note, however, that it does not support current GDPR functionality in the mainstream TD SDKs.
77

@@ -135,6 +135,8 @@ It depends on the characteristic of your application when to upload and how ofte
135135

136136
The sent events is going to be buffered for a few minutes before they get imported into Treasure Data storage.
137137

138+
In tvOS, cache storage is stored in cache directory which can be purged at any time. It is highly recommended to call upload events APIs as requently as possible to prevent loss of data.
139+
138140
### Retry uploading and deduplication
139141

140142
This SDK imports events in exactly once style with the combination of these features.
@@ -516,6 +518,13 @@ These can be opted back in by calling `enableCustomEvent` or `enableAppLifecycle
516518

517519
- Use `resetUniqId` to reset the identification of device on subsequent events. `td_uuid` will be randomized to another value and an extra event is captured with `{"td_ios_event": "forget_device_id", "td_uuid": <old_uuid>}` to the `defaultTable`.
518520

521+
## tvOS
522+
523+
This SDK supports Apple tvOS version 12 and up. APIs and their behaviors are largely the same as being used in iOS application, except:
524+
525+
! In tvOS, cache storage is stored in cache directory which can be purged at any time. It is highly recommended to call upload events APIs as requently as possible to prevent loss of data.
526+
527+
519528
## Troubleshooting
520529

521530
#### With "Data Protection" enabled, TD iOS SDK occasionally crashes

0 commit comments

Comments
 (0)