File tree Expand file tree Collapse file tree 6 files changed +31
-15
lines changed
Examples/apps/ObjCExample/ObjCExample
project.xcworkspace/xcshareddata/swiftpm Expand file tree Collapse file tree 6 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ @implementation AppDelegate
1919- (BOOL )application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions {
2020 // Override point for customization after application launch.
2121 SEGConfiguration *config = [[SEGConfiguration alloc ] initWithWriteKey: @" WRITE_KEY" ];
22- config.trackApplicationLifecycleEvents = TRUE ;
22+ config.trackApplicationLifecycleEvents = YES ;
2323
2424 SEGAnalytics *analytics = [[SEGAnalytics alloc ] initWithConfiguration: config];
2525
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ let package = Package(
2323 . package (
2424 name: " Sovran " ,
2525 url: " https://github.com/segmentio/Sovran-Swift.git " ,
26- from: " 1.0.1 "
26+ from: " 1.0.2 "
2727 )
2828 ] ,
2929 targets: [
Original file line number Diff line number Diff line change 853853 repositoryURL = "
[email protected] :segmentio/Sovran-Swift.git";
854854 requirement = {
855855 kind = upToNextMajorVersion;
856- minimumVersion = 1.0.0 ;
856+ minimumVersion = 1.0.2 ;
857857 };
858858 };
859859/* End XCRemoteSwiftPackageReference section */
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ extension Analytics {
104104 }
105105
106106 internal func checkSettings( ) {
107+ #if DEBUG
107108 if isUnitTesting {
108109 // we don't really wanna wait for this network call during tests...
109110 // but we should make it work similarly.
@@ -116,6 +117,7 @@ extension Analytics {
116117 }
117118 return
118119 }
120+ #endif
119121
120122 let writeKey = self . configuration. values. writeKey
121123 let httpClient = HTTPClient ( analytics: self , cdnHost: configuration. values. cdnHost)
Original file line number Diff line number Diff line change 77
88import Foundation
99
10+ /// Inquire as to whether we are within a Unit Testing environment.
11+ #if DEBUG
1012internal var isUnitTesting : Bool = {
11- let env = ProcessInfo . processInfo. environment
12- let value = ( env [ " XCTestConfigurationFilePath " ] != nil )
13- return value
13+ // this will work on apple platforms, but fail on linux.
14+ if NSClassFromString ( " XCTestCase " ) != nil {
15+ return true
16+ }
17+ // this will work on linux and apple platforms, but not in anything with a UI
18+ // because XCTest doesn't come into the call stack till much later.
19+ let matches = Thread . callStackSymbols. filter { line in
20+ return line. contains ( " XCTest " ) || line. contains ( " xctest " )
21+ }
22+ if matches. count > 0 {
23+ return true
24+ }
25+ // this will work on CircleCI to correctly detect test running.
26+ if ProcessInfo . processInfo. environment [ " CIRCLE_WORKFLOW_WORKSPACE_ID " ] != nil {
27+ return true
28+ }
29+ // couldn't see anything that indicated we were testing.
30+ return false
1431} ( )
32+ #endif
1533
1634internal var isAppExtension : Bool = {
1735 if Bundle . main. bundlePath. hasSuffix ( " .appex " ) {
@@ -21,11 +39,7 @@ internal var isAppExtension: Bool = {
2139} ( )
2240
2341internal func exceptionFailure( _ message: String ) {
24- if isUnitTesting {
25- assertionFailure ( message)
26- } else {
27- #if DEBUG
28- assertionFailure ( message)
29- #endif
30- }
42+ #if DEBUG
43+ assertionFailure ( message)
44+ #endif
3145}
You can’t perform that action at this time.
0 commit comments