iOS Flurry:从后台线程调用的UI API

RSN*_*RSN 2 beta xcode flurry ios

使用xcode 9.3 beta实现乱码会导致在后台线程上调用UI API的警告.必须仅从主线程调用.

知道怎么做才能避免这种情况 - 只是为了解决这个问题吗?

app delegate中使用的代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    let builder = FlurrySessionBuilder.init()
                                      .withAppVersion("1.0")
                                      .withLogLevel(FlurryLogLevelAll)
                                      .withCrashReporting(true)
                                      .withSessionContinueSeconds(10)

    // Replace YOUR_API_KEY with the api key in the downloaded package
    Flurry.startSession("YOUR_API_KEY", with: builder)
    return true
}
Run Code Online (Sandbox Code Playgroud)

KKR*_*cks 6

试试这个 :

目标C.

dispatch_async(dispatch_get_main_queue(), ^{
 // add UI related changes here
    });
Run Code Online (Sandbox Code Playgroud)

迅速

DispatchQueue.main.async {
// add UI related changes here
}
Run Code Online (Sandbox Code Playgroud)