Computop / Computop-iOS

1 stars 3 forks source link

UI API called on a background thread #4

Closed michaelkamphausen closed 6 years ago

michaelkamphausen commented 6 years ago

When instantiating a CMPCheckoutViewController with instantiateCheckoutViewController on the main thread and presenting it from the main thread, the Main Thread Checker detects that UI APIs are called from a background thread. Please note the Backtrace:

Main Thread Checker: UI API called on a background thread: -[WKWebView loadRequest:] PID: 1131, TID: 615133, Thread name: (none), Queue name: NSOperationQueue 0x2803fef00 (QOS: UNSPECIFIED), QoS: 0 Backtrace: 4 Computop 0x00000001036fbb90 44-[CMPCheckoutViewController viewWillAppear:]_block_invoke + 76 5 Computop 0x00000001036ff1f8 55-[CMPPaymentMethodRequest paymentURLRequest:onFailure:]_block_invoke_2 + 176 6 Computop 0x00000001036ff498 61-[CMPPaymentMethodRequest createPaymentURLRequest:onFailure:]_block_invoke + 116 7 Computop 0x00000001036ff654 48-[CMPPaymentMethodRequest paymentURL:onFailure:]_block_invoke + 124 8 Computop 0x00000001036fff74 55-[CMPPaymentMethodRequest generateURLString:onFailure:]_block_invoke + 1780 9 Computop 0x0000000103700408 91-[CMPPaymentMethodRequest generateURLQueryDataParameterWithMACEnabled:onSuccess:onFailure:]_block_invoke.138 + 56 10 Computop 0x00000001037008cc 83-[CMPPaymentMethodRequest encryptURLQueryDataParameterWithMAC:OnSuccess:onFailure:]_block_invoke + 252 11 Computop 0x00000001036f8dc8 +[CMPEncryptor performBlowfishOnData:context:key:options:iv:success:failure:] + 524 12 Computop 0x00000001036f89a0 +[CMPEncryptor encryptData:withKey:success:failure:] + 252 13 Computop 0x000000010370074c -[CMPPaymentMethodRequest encryptURLQueryDataParameterWithMAC:OnSuccess:onFailure:] + 756 14 Computop 0x00000001037001b8 -[CMPPaymentMethodRequest generateURLQueryDataParameterWithMACEnabled:onSuccess:onFailure:] + 312 15 Computop 0x00000001036ff830 -[CMPPaymentMethodRequest generateURLString:onFailure:] + 392 16 Computop 0x00000001036ff5a4 -[CMPPaymentMethodRequest paymentURL:onFailure:] + 188 17 Computop 0x00000001036ff3f0 -[CMPPaymentMethodRequest createPaymentURLRequest:onFailure:] + 188 18 Computop 0x00000001036ff120 55-[CMPPaymentMethodRequest paymentURLRequest:onFailure:]_block_invoke + 180 19 Computop 0x00000001037050ac 44-[CMPTokenRequest authentication:onFailure:]_block_invoke + 516 20 Computop 0x00000001036fe744 59-[CMPServices performPostRequest:withData:success:failure:]_block_invoke + 156 21 app 0x00000001017a6e30 __SplunkNSCFURLSessionUploadTaskWithRequestFromDataCompletionHandler_block_invoke + 460 22 CFNetwork 0x0000000186ffa480 + 32 23 CFNetwork 0x00000001870136d0 + 176 24 Foundation 0x00000001874af120 + 16 25 Foundation 0x00000001873f009c + 72 26 Foundation 0x00000001873ef468 + 844 27 Foundation 0x00000001874b0fb4 + 272 28 libdispatch.dylib 0x00000001044263b4 _dispatch_block_async_invoke2 + 104 29 libdispatch.dylib 0x0000000104411338 _dispatch_client_callout + 16 30 libdispatch.dylib 0x000000010441c5e4 _dispatch_continuation_pop + 528 31 libdispatch.dylib 0x000000010441ba20 _dispatch_async_redirect_invoke + 632 32 libdispatch.dylib 0x00000001044293ac _dispatch_root_queue_drain + 376 33 libdispatch.dylib 0x0000000104429db0 _dispatch_worker_thread2 + 156 34 libsystem_pthread.dylib 0x000000018667d5c0 _pthread_wqthread + 480 35 libsystem_pthread.dylib 0x000000018667d36c start_wqthread + 4

geraldcollaku commented 6 years ago

We already dispatched the call for loading the webView request to the main thread for version 1.2.1, so you won't notice these Backtraces anymore.