I have following code snippets where sometimes this line: self.onPostExecute(transItem)
leads to application crash:
func execute(){
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
//Your code to execute in background...
println("Your code to execute in background...")
var transItem:WmTransferItem = self.doInBackground()
dispatch_async(dispatch_get_main_queue(), {
println("code to be executed on the main thread when background task is finished")
self.onPostExecute(transItem) // line 639
});
});
}
What does that mean: with unmangled suffix "_promote0"
Exception:
Thread : Crashed: com.apple.main-thread
0 MyApplication 0x000e9ed8 MyApplication.WmBuildGroupsTask.onPostExecute (MyApplication.WmBuildGroupsTask)(MyApplication.WmTransferItem) -> () (WmBuildGroupsTask.swift:419)
1 libswiftCore.dylib 0x0045803b swift_reportFatalError + 162
2 MyApplication 0x000f2ddc MyApplication.WmBuildGroupsTask.(execute (MyApplication.WmBuildGroupsTask) -> () -> ()).(closure #1).(closure #1) with unmangled suffix "_promote0" (WmBuildGroupsTask.swift:639)
3 MyApplication 0x000f2e34 reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_unowned @objc_block () -> (@unowned ()) (WmBuildGroupsTask.swift)
4 libdispatch.dylib 0x3a133d53 _dispatch_call_block_and_release + 10
5 libdispatch.dylib 0x3a133d3f _dispatch_client_callout + 22
6 libdispatch.dylib 0x3a1366c3 _dispatch_main_queue_callback_4CF + 278
7 CoreFoundation 0x2f47a641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
8 CoreFoundation 0x2f478f0d __CFRunLoopRun + 1308
9 CoreFoundation 0x2f3e3729 CFRunLoopRunSpecific + 524
10 CoreFoundation 0x2f3e350b CFRunLoopRunInMode + 106
11 GraphicsServices 0x343526d3 GSEventRunModal + 138
12 UIKit 0x31d44871 UIApplicationMain + 1136
13 MyApplication 0x00166417 main (main.m:32)
What I'm doing wrong?
Thanks,