Skip to content

Commit e35f7f1

Browse files
bsneedBrandon Sneed
andauthored
Add objective-c compatibility / example (#39)
* Add objective-c compatibility / example * Added convenience methods * Set default params; Removed identify(traits) * Fixed mistypeing * Fixed project changes * Pinned flurry version * Added objc example to test suite * Added tests for non-trivial objc stuff * Fixed missing state updates in identify. * Added skip for objc tests on linux. Co-authored-by: Brandon Sneed <brandon.sneed@segment.com>
1 parent ebdd751 commit e35f7f1

File tree

27 files changed

+1282
-154
lines changed

27 files changed

+1282
-154
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ jobs:
111111
command: |
112112
cd Examples/apps/DestinationsExample
113113
xcodebuild -workspace "DestinationsExample.xcworkspace" -scheme "DestinationsExample" -sdk iphonesimulator
114+
- run:
115+
# build for ios simulator
116+
command: |
117+
cd Examples/apps/ObjCExample
118+
xcodebuild -workspace "ObjCExample.xcworkspace" -scheme "ObjCExample" -sdk iphonesimulator
114119
- run:
115120
# build for ios simulator
116121
command: |

Examples/apps/DestinationsExample/DestinationsExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@
447447
isa = XCRemoteSwiftPackageReference;
448448
repositoryURL = "git@github.com:flurry/FlurrySwiftPackage.git";
449449
requirement = {
450-
kind = upToNextMajorVersion;
451-
minimumVersion = 11.2.1;
450+
kind = exactVersion;
451+
version = 11.2.1;
452452
};
453453
};
454454
469F7B21266013100038E773 /* XCRemoteSwiftPackageReference "ios_sdk" */ = {
Lines changed: 367 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,367 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 52;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
464247BC26C6D7A700CAD301 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247BB26C6D7A700CAD301 /* AppDelegate.m */; };
11+
464247BF26C6D7A700CAD301 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247BE26C6D7A700CAD301 /* SceneDelegate.m */; };
12+
464247C226C6D7A700CAD301 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247C126C6D7A700CAD301 /* ViewController.m */; };
13+
464247C526C6D7A700CAD301 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 464247C326C6D7A700CAD301 /* Main.storyboard */; };
14+
464247C726C6D7A800CAD301 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 464247C626C6D7A800CAD301 /* Assets.xcassets */; };
15+
464247CA26C6D7A800CAD301 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 464247C826C6D7A800CAD301 /* LaunchScreen.storyboard */; };
16+
464247CD26C6D7A800CAD301 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 464247CC26C6D7A800CAD301 /* main.m */; };
17+
464247D526C6D7DC00CAD301 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = 464247D426C6D7DC00CAD301 /* Segment */; };
18+
/* End PBXBuildFile section */
19+
20+
/* Begin PBXFileReference section */
21+
464247B726C6D7A700CAD301 /* ObjCExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjCExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
22+
464247BA26C6D7A700CAD301 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
23+
464247BB26C6D7A700CAD301 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
24+
464247BD26C6D7A700CAD301 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
25+
464247BE26C6D7A700CAD301 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
26+
464247C026C6D7A700CAD301 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
27+
464247C126C6D7A700CAD301 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
28+
464247C426C6D7A700CAD301 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
29+
464247C626C6D7A800CAD301 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
30+
464247C926C6D7A800CAD301 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
31+
464247CB26C6D7A800CAD301 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
32+
464247CC26C6D7A800CAD301 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
33+
/* End PBXFileReference section */
34+
35+
/* Begin PBXFrameworksBuildPhase section */
36+
464247B426C6D7A700CAD301 /* Frameworks */ = {
37+
isa = PBXFrameworksBuildPhase;
38+
buildActionMask = 2147483647;
39+
files = (
40+
464247D526C6D7DC00CAD301 /* Segment in Frameworks */,
41+
);
42+
runOnlyForDeploymentPostprocessing = 0;
43+
};
44+
/* End PBXFrameworksBuildPhase section */
45+
46+
/* Begin PBXGroup section */
47+
464247AE26C6D7A700CAD301 = {
48+
isa = PBXGroup;
49+
children = (
50+
464247B926C6D7A700CAD301 /* ObjCExample */,
51+
464247B826C6D7A700CAD301 /* Products */,
52+
464247D326C6D7DC00CAD301 /* Frameworks */,
53+
);
54+
sourceTree = "<group>";
55+
};
56+
464247B826C6D7A700CAD301 /* Products */ = {
57+
isa = PBXGroup;
58+
children = (
59+
464247B726C6D7A700CAD301 /* ObjCExample.app */,
60+
);
61+
name = Products;
62+
sourceTree = "<group>";
63+
};
64+
464247B926C6D7A700CAD301 /* ObjCExample */ = {
65+
isa = PBXGroup;
66+
children = (
67+
464247BA26C6D7A700CAD301 /* AppDelegate.h */,
68+
464247BB26C6D7A700CAD301 /* AppDelegate.m */,
69+
464247BD26C6D7A700CAD301 /* SceneDelegate.h */,
70+
464247BE26C6D7A700CAD301 /* SceneDelegate.m */,
71+
464247C026C6D7A700CAD301 /* ViewController.h */,
72+
464247C126C6D7A700CAD301 /* ViewController.m */,
73+
464247C326C6D7A700CAD301 /* Main.storyboard */,
74+
464247C626C6D7A800CAD301 /* Assets.xcassets */,
75+
464247C826C6D7A800CAD301 /* LaunchScreen.storyboard */,
76+
464247CB26C6D7A800CAD301 /* Info.plist */,
77+
464247CC26C6D7A800CAD301 /* main.m */,
78+
);
79+
path = ObjCExample;
80+
sourceTree = "<group>";
81+
};
82+
464247D326C6D7DC00CAD301 /* Frameworks */ = {
83+
isa = PBXGroup;
84+
children = (
85+
);
86+
name = Frameworks;
87+
sourceTree = "<group>";
88+
};
89+
/* End PBXGroup section */
90+
91+
/* Begin PBXNativeTarget section */
92+
464247B626C6D7A700CAD301 /* ObjCExample */ = {
93+
isa = PBXNativeTarget;
94+
buildConfigurationList = 464247D026C6D7A800CAD301 /* Build configuration list for PBXNativeTarget "ObjCExample" */;
95+
buildPhases = (
96+
464247B326C6D7A700CAD301 /* Sources */,
97+
464247B426C6D7A700CAD301 /* Frameworks */,
98+
464247B526C6D7A700CAD301 /* Resources */,
99+
);
100+
buildRules = (
101+
);
102+
dependencies = (
103+
);
104+
name = ObjCExample;
105+
packageProductDependencies = (
106+
464247D426C6D7DC00CAD301 /* Segment */,
107+
);
108+
productName = ObjCExample;
109+
productReference = 464247B726C6D7A700CAD301 /* ObjCExample.app */;
110+
productType = "com.apple.product-type.application";
111+
};
112+
/* End PBXNativeTarget section */
113+
114+
/* Begin PBXProject section */
115+
464247AF26C6D7A700CAD301 /* Project object */ = {
116+
isa = PBXProject;
117+
attributes = {
118+
LastUpgradeCheck = 1250;
119+
TargetAttributes = {
120+
464247B626C6D7A700CAD301 = {
121+
CreatedOnToolsVersion = 12.5.1;
122+
};
123+
};
124+
};
125+
buildConfigurationList = 464247B226C6D7A700CAD301 /* Build configuration list for PBXProject "ObjCExample" */;
126+
compatibilityVersion = "Xcode 9.3";
127+
developmentRegion = en;
128+
hasScannedForEncodings = 0;
129+
knownRegions = (
130+
en,
131+
Base,
132+
);
133+
mainGroup = 464247AE26C6D7A700CAD301;
134+
productRefGroup = 464247B826C6D7A700CAD301 /* Products */;
135+
projectDirPath = "";
136+
projectRoot = "";
137+
targets = (
138+
464247B626C6D7A700CAD301 /* ObjCExample */,
139+
);
140+
};
141+
/* End PBXProject section */
142+
143+
/* Begin PBXResourcesBuildPhase section */
144+
464247B526C6D7A700CAD301 /* Resources */ = {
145+
isa = PBXResourcesBuildPhase;
146+
buildActionMask = 2147483647;
147+
files = (
148+
464247CA26C6D7A800CAD301 /* LaunchScreen.storyboard in Resources */,
149+
464247C726C6D7A800CAD301 /* Assets.xcassets in Resources */,
150+
464247C526C6D7A700CAD301 /* Main.storyboard in Resources */,
151+
);
152+
runOnlyForDeploymentPostprocessing = 0;
153+
};
154+
/* End PBXResourcesBuildPhase section */
155+
156+
/* Begin PBXSourcesBuildPhase section */
157+
464247B326C6D7A700CAD301 /* Sources */ = {
158+
isa = PBXSourcesBuildPhase;
159+
buildActionMask = 2147483647;
160+
files = (
161+
464247C226C6D7A700CAD301 /* ViewController.m in Sources */,
162+
464247BC26C6D7A700CAD301 /* AppDelegate.m in Sources */,
163+
464247CD26C6D7A800CAD301 /* main.m in Sources */,
164+
464247BF26C6D7A700CAD301 /* SceneDelegate.m in Sources */,
165+
);
166+
runOnlyForDeploymentPostprocessing = 0;
167+
};
168+
/* End PBXSourcesBuildPhase section */
169+
170+
/* Begin PBXVariantGroup section */
171+
464247C326C6D7A700CAD301 /* Main.storyboard */ = {
172+
isa = PBXVariantGroup;
173+
children = (
174+
464247C426C6D7A700CAD301 /* Base */,
175+
);
176+
name = Main.storyboard;
177+
sourceTree = "<group>";
178+
};
179+
464247C826C6D7A800CAD301 /* LaunchScreen.storyboard */ = {
180+
isa = PBXVariantGroup;
181+
children = (
182+
464247C926C6D7A800CAD301 /* Base */,
183+
);
184+
name = LaunchScreen.storyboard;
185+
sourceTree = "<group>";
186+
};
187+
/* End PBXVariantGroup section */
188+
189+
/* Begin XCBuildConfiguration section */
190+
464247CE26C6D7A800CAD301 /* Debug */ = {
191+
isa = XCBuildConfiguration;
192+
buildSettings = {
193+
ALWAYS_SEARCH_USER_PATHS = NO;
194+
CLANG_ANALYZER_NONNULL = YES;
195+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
196+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
197+
CLANG_CXX_LIBRARY = "libc++";
198+
CLANG_ENABLE_MODULES = YES;
199+
CLANG_ENABLE_OBJC_ARC = YES;
200+
CLANG_ENABLE_OBJC_WEAK = YES;
201+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
202+
CLANG_WARN_BOOL_CONVERSION = YES;
203+
CLANG_WARN_COMMA = YES;
204+
CLANG_WARN_CONSTANT_CONVERSION = YES;
205+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
206+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
207+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
208+
CLANG_WARN_EMPTY_BODY = YES;
209+
CLANG_WARN_ENUM_CONVERSION = YES;
210+
CLANG_WARN_INFINITE_RECURSION = YES;
211+
CLANG_WARN_INT_CONVERSION = YES;
212+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
213+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
214+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
215+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
216+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
217+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
218+
CLANG_WARN_STRICT_PROTOTYPES = YES;
219+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
220+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
221+
CLANG_WARN_UNREACHABLE_CODE = YES;
222+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
223+
COPY_PHASE_STRIP = NO;
224+
DEBUG_INFORMATION_FORMAT = dwarf;
225+
ENABLE_STRICT_OBJC_MSGSEND = YES;
226+
ENABLE_TESTABILITY = YES;
227+
GCC_C_LANGUAGE_STANDARD = gnu11;
228+
GCC_DYNAMIC_NO_PIC = NO;
229+
GCC_NO_COMMON_BLOCKS = YES;
230+
GCC_OPTIMIZATION_LEVEL = 0;
231+
GCC_PREPROCESSOR_DEFINITIONS = (
232+
"DEBUG=1",
233+
"$(inherited)",
234+
);
235+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
236+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
237+
GCC_WARN_UNDECLARED_SELECTOR = YES;
238+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
239+
GCC_WARN_UNUSED_FUNCTION = YES;
240+
GCC_WARN_UNUSED_VARIABLE = YES;
241+
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
242+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
243+
MTL_FAST_MATH = YES;
244+
ONLY_ACTIVE_ARCH = YES;
245+
SDKROOT = iphoneos;
246+
};
247+
name = Debug;
248+
};
249+
464247CF26C6D7A800CAD301 /* Release */ = {
250+
isa = XCBuildConfiguration;
251+
buildSettings = {
252+
ALWAYS_SEARCH_USER_PATHS = NO;
253+
CLANG_ANALYZER_NONNULL = YES;
254+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
255+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
256+
CLANG_CXX_LIBRARY = "libc++";
257+
CLANG_ENABLE_MODULES = YES;
258+
CLANG_ENABLE_OBJC_ARC = YES;
259+
CLANG_ENABLE_OBJC_WEAK = YES;
260+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
261+
CLANG_WARN_BOOL_CONVERSION = YES;
262+
CLANG_WARN_COMMA = YES;
263+
CLANG_WARN_CONSTANT_CONVERSION = YES;
264+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
265+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
266+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
267+
CLANG_WARN_EMPTY_BODY = YES;
268+
CLANG_WARN_ENUM_CONVERSION = YES;
269+
CLANG_WARN_INFINITE_RECURSION = YES;
270+
CLANG_WARN_INT_CONVERSION = YES;
271+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
272+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
273+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
274+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
275+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
276+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
277+
CLANG_WARN_STRICT_PROTOTYPES = YES;
278+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
279+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
280+
CLANG_WARN_UNREACHABLE_CODE = YES;
281+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
282+
COPY_PHASE_STRIP = NO;
283+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
284+
ENABLE_NS_ASSERTIONS = NO;
285+
ENABLE_STRICT_OBJC_MSGSEND = YES;
286+
GCC_C_LANGUAGE_STANDARD = gnu11;
287+
GCC_NO_COMMON_BLOCKS = YES;
288+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
289+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
290+
GCC_WARN_UNDECLARED_SELECTOR = YES;
291+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
292+
GCC_WARN_UNUSED_FUNCTION = YES;
293+
GCC_WARN_UNUSED_VARIABLE = YES;
294+
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
295+
MTL_ENABLE_DEBUG_INFO = NO;
296+
MTL_FAST_MATH = YES;
297+
SDKROOT = iphoneos;
298+
VALIDATE_PRODUCT = YES;
299+
};
300+
name = Release;
301+
};
302+
464247D126C6D7A800CAD301 /* Debug */ = {
303+
isa = XCBuildConfiguration;
304+
buildSettings = {
305+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
306+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
307+
CODE_SIGN_STYLE = Automatic;
308+
INFOPLIST_FILE = ObjCExample/Info.plist;
309+
LD_RUNPATH_SEARCH_PATHS = (
310+
"$(inherited)",
311+
"@executable_path/Frameworks",
312+
);
313+
PRODUCT_BUNDLE_IDENTIFIER = com.segment.ObjCExample;
314+
PRODUCT_NAME = "$(TARGET_NAME)";
315+
TARGETED_DEVICE_FAMILY = "1,2";
316+
};
317+
name = Debug;
318+
};
319+
464247D226C6D7A800CAD301 /* Release */ = {
320+
isa = XCBuildConfiguration;
321+
buildSettings = {
322+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
323+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
324+
CODE_SIGN_STYLE = Automatic;
325+
INFOPLIST_FILE = ObjCExample/Info.plist;
326+
LD_RUNPATH_SEARCH_PATHS = (
327+
"$(inherited)",
328+
"@executable_path/Frameworks",
329+
);
330+
PRODUCT_BUNDLE_IDENTIFIER = com.segment.ObjCExample;
331+
PRODUCT_NAME = "$(TARGET_NAME)";
332+
TARGETED_DEVICE_FAMILY = "1,2";
333+
};
334+
name = Release;
335+
};
336+
/* End XCBuildConfiguration section */
337+
338+
/* Begin XCConfigurationList section */
339+
464247B226C6D7A700CAD301 /* Build configuration list for PBXProject "ObjCExample" */ = {
340+
isa = XCConfigurationList;
341+
buildConfigurations = (
342+
464247CE26C6D7A800CAD301 /* Debug */,
343+
464247CF26C6D7A800CAD301 /* Release */,
344+
);
345+
defaultConfigurationIsVisible = 0;
346+
defaultConfigurationName = Release;
347+
};
348+
464247D026C6D7A800CAD301 /* Build configuration list for PBXNativeTarget "ObjCExample" */ = {
349+
isa = XCConfigurationList;
350+
buildConfigurations = (
351+
464247D126C6D7A800CAD301 /* Debug */,
352+
464247D226C6D7A800CAD301 /* Release */,
353+
);
354+
defaultConfigurationIsVisible = 0;
355+
defaultConfigurationName = Release;
356+
};
357+
/* End XCConfigurationList section */
358+
359+
/* Begin XCSwiftPackageProductDependency section */
360+
464247D426C6D7DC00CAD301 /* Segment */ = {
361+
isa = XCSwiftPackageProductDependency;
362+
productName = Segment;
363+
};
364+
/* End XCSwiftPackageProductDependency section */
365+
};
366+
rootObject = 464247AF26C6D7A700CAD301 /* Project object */;
367+
}

Examples/apps/ObjCExample/ObjCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)