I want the AppDelegate to perform the selector if it is possible, here is my code:
func RunLoopSourceScheduleRoutine(info:UnsafeMutableRawPointer?,r1:CFRunLoop?,mode:CFRunLoopMode?)->Void{
let obj : RunLoopSource = Unmanaged<RunLoopSource>.fromOpaque(info!).takeUnretainedValue()
let theContext = RunLoopContext.init(initWithSource: obj, andLoop: r1!)
let del = UIApplication.shared.delegate
del.performSelector(onMainThread: #selector(removeSource), with: theContext, waitUntilDone: false)
}
I've tried this :(The App crashes)
AppDelegate.performSelector(onMainThread: #selector(removeSource), with: theContext, waitUntilDone: false)
How to perform a selector on the main thread from a global function?