Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 9 : UI API called on a background thread #137

Closed
VPTeamMobile opened this issue Sep 26, 2017 · 1 comment
Closed

Xcode 9 : UI API called on a background thread #137

VPTeamMobile opened this issue Sep 26, 2017 · 1 comment

Comments

@VPTeamMobile
Copy link

HI,

I have a crash from your SDK (version 2.2.1) when I am running my UITests on Xcode 9 :

Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 38308, TID: 1263418, Thread name: (none), Queue name: NSManagedObjectContext 0x6000003c2850, QoS: 0
Backtrace:
4   Mixpanel                            0x000000010e71bf61 _T08Mixpanel15AutomaticEventsC05setupB12PushTrackingyyF + 177
5   Mixpanel                            0x000000010e71b757 _T08Mixpanel15AutomaticEventsC010initializeC0yyF + 2423
6   Mixpanel                            0x000000010e6fd94a _T08Mixpanel0A8InstanceCACSSSg8apiToken_s10DictionaryVySC29UIApplicationLaunchOptionsKeyVypGSg06launchH0Sd13flushIntervalSS4nametcfcTf4ggngXn_n + 1882
7   Mixpanel                            0x000000010e7da24c _T08MixpanelAAC10initializeAA0A8InstanceCSS5token_s10DictionaryVySC29UIApplicationLaunchOptionsKeyVypGSg06launchH0Sd13flushIntervalSS12instanceNametFZ + 236
8   vente-privee                        0x000000010caab1f5 _T012vente_privee15MixPanelManagerC13Configuration33_875168FBC80821E78DD3B448FE61BC21LLO10initialize8Mixpanel0N8InstanceCSS5token_tF + 181
9   vente-privee                        0x000000010caab12f _T012vente_privee15MixPanelManagerC13Configuration33_875168FBC80821E78DD3B448FE61BC21LLO8instance8Mixpanel0N8InstanceCyFAJyKXKfu_ + 63
10  vente-privee                        0x000000010cab7220 _T012vente_privee15MixPanelManagerC13Configuration33_875168FBC80821E78DD3B448FE61BC21LLO8instance8Mixpanel0N8InstanceCyFAJyKXKfu_TA + 48
11  vente-privee                        0x000000010caab03e _T012vente_privee15MixPanelManagerC13Configuration33_875168FBC80821E78DD3B448FE61BC21LLO8instance8Mixpanel0N8InstanceCyF + 238
12  vente-privee                        0x000000010caab4c6 _T012vente_privee15MixPanelManagerC03mixD8Instance8Mixpanel0hG0CyFZ + 118
13  vente-privee                        0x000000010cd08fa5 _T012vente_privee22MixPanelPeoplePropertyO06peopleF033_820539499D4BAFC1A6DF3189884886BCLLySi5value_tF + 85
14  vente-privee                        0x000000010cd09980 _T012vente_privee22MixPanelPeoplePropertyO8registeryyF + 1696
15  vente-privee                        0x000000010cd0b10d _T012vente_privee15MixPanelManagerC21superPropertiesMemberyAA0H0C6member_tFZ + 797
16  vente-privee                        0x000000010cccbee3 _T012vente_privee20AuthenticationParserC20createOrUpdateObjectyyF + 3187
17  vente-privee                        0x000000010ca9c75a _T012vente_privee14ResponseParserC13parseDidStarty9Alamofire04DataC0VyypGF + 58
18  vente-privee                        0x000000010ca9c355 _T012vente_privee14ResponseParserC14parseWillStarty9Alamofire04DataC0VyypGFySo22NSManagedObjectContextCcfU_ + 821
19  vente-privee                        0x000000010ca9c4e4 _T012vente_privee14ResponseParserC14parseWillStarty9Alamofire04DataC0VyypGFySo22NSManagedObjectContextCcfU_TA + 84
20  vente-privee                        0x000000010c78de0e _T0So22NSManagedObjectContextCIxx_ABIyBy_TR + 62
21  MagicalRecord                       0x000000010f6e744c __51+[MagicalRecord(Actions) saveWithBlock:completion:]_block_invoke + 95
22  CoreData                            0x0000000111b6fbf8 developerSubmittedBlockToNSManagedObjectContextPerform + 168
23  libdispatch.dylib                   0x0000000117de52b5 _dispatch_client_callout + 8
24  libdispatch.dylib                   0x0000000117dece3f _dispatch_queue_serial_drain + 654
25  libdispatch.dylib                   0x0000000117ded690 _dispatch_queue_invoke + 329
26  libdispatch.dylib                   0x0000000117de9d94 _dispatch_queue_override_invoke + 477
27  libdispatch.dylib                   0x0000000117defa72 _dispatch_root_queue_drain + 568
28  libdispatch.dylib                   0x0000000117def7dc _dispatch_worker_thread3 + 119
29  libsystem_pthread.dylib             0x000000011829b5a2 _pthread_wqthread + 1299
30  libsystem_pthread.dylib             0x000000011829b07d start_wqthread + 13

The new Xcode feature : warning runtime is also reporting this issue :

UI API called from background thread Group
file:///Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/AutomaticEvents.swift: runtime: UI API called from background thread: UIApplication.delegate must be used from main thread only

Thread 66
#0	0x00000001059d8f60 in AutomaticEvents.setupAutomaticPushTracking() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/AutomaticEvents.swift:163
#1	0x00000001059d8757 in AutomaticEvents.initializeEvents() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/AutomaticEvents.swift:87
#2	0x00000001059ba94a in specialized MixpanelInstance.init(apiToken:launchOptions:flushInterval:name:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/MixpanelInstance.swift:264
#3	0x0000000105a9724c in MixpanelInstance.init(apiToken:launchOptions:flushInterval:name:) [inlined] ()
#4	0x0000000105a97215 in MixpanelInstance.__allocating_init(apiToken:launchOptions:flushInterval:name:) [inlined] ()
#5	0x0000000105a97215 in MixpanelManager.initialize(token:launchOptions:flushInterval:instanceName:) [inlined] at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/Mixpanel.swift:142
#6	0x0000000105a97215 in static Mixpanel.initialize(token:launchOptions:flushInterval:instanceName:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/Carthage/Checkouts/mixpanel-swift/Mixpanel/Mixpanel.swift:44
#7	0x0000000105a97215 in static Mixpanel.initialize(token:launchOptions:flushInterval:instanceName:) ()
#8	0x0000000105a97215 in static Mixpanel.initialize(token:launchOptions:flushInterval:instanceName:) ()
#9	0x0000000105a97215 in static Mixpanel.initialize(token:launchOptions:flushInterval:instanceName:) ()
#10	0x0000000103d5e425 in MixPanelManager.Configuration.initialize(token:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager.swift:71
#11	0x0000000103d5e35f in implicit closure #1 in MixPanelManager.Configuration.instance() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager.swift:61
#12	0x0000000103d6a450 in partial apply for implicit closure #1 in MixPanelManager.Configuration.instance() ()
#13	0x0000000103d5e26e in MixPanelManager.Configuration.instance() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager.swift:61
#14	0x0000000103d5e6f6 in static MixPanelManager.mixPanelInstance() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager.swift:85
#15	0x0000000103fbc035 in MixPanelPeopleProperty.peopleProperty(value:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager+PeopleProperty.swift:164
#16	0x0000000103fbca10 in MixPanelPeopleProperty.register() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager+PeopleProperty.swift:178
#17	0x0000000103fbe19d in static MixPanelManager.superPropertiesMember(member:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Managers/MixPanel/MixPanelManager+SuperProperty.swift:26
#18	0x0000000103f7ef73 in AuthenticationParser.createOrUpdateObject() at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Network/ResponseParser/Authentication/AuthenticationParser.swift:50
#19	0x0000000103d4f98a in ResponseParser.parseDidStart(_:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Network/ResponseParser/ResponseParser.swift:297
#20	0x0000000103d4f585 in closure #1 in ResponseParser.parseWillStart(_:) at /Users/aurelienpinston/Documents/Projects/iOS-vente-privee/vente-privee/vente-privee/Sources/Network/ResponseParser/ResponseParser.swift:290

I am calling methods from your SDK in a background thread.

Thanks

@yarneo
Copy link
Contributor

yarneo commented Oct 19, 2017

this has been fixed in the latest release ( v2.2.2 ) , thanks!

@yarneo yarneo closed this as completed Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants