I wrote a NativeX Phonegap/Cordova plugin. Now I'm trying to push the fetchAdWithCustomPlacement
call into a background thread to avoid blocking the main thread.
NSString* adName = [command.arguments objectAtIndex:0];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[NativeXSDK sharedInstance] fetchAdWithCustomPlacement:adName delegate:self];
});
Nothing errors, and the dispatch_async
block is definitely run, but the corresponding NativeX callback never fires, as it does if I fetch the ad in the main thread. Callback:
- (void)nativeXAdView:(NativeXAdView *)adView didLoadWithPlacement:(NSString *)placement
First time using GCD. Don't know if I'm doing something wrong or if its the NativeX library. They distribute is a static library so I haven't read the source.
Any help is appreciated!