Question, if I am writing async code in the notification service extension, I understand it terminates after 30 seconds.
If I want to wait until these async methods finish before calling the content handler, I believe an option I have is to use dispatch groups. However I am open to other solutions if there are better options.
My question is, if I use dispatch groups, is there any issue in using the main queue here? Or does the main thread not make sense to use in the context of the NSE?
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
if (self.contentHandler) {
self.contentHandler(self.bestAttemptContent);
}
});
Or is it recommended to instead use a different queue in the NSE?
dispatch_queue_t nseQueue = dispatch_queue_create("com.blah.blah.nse.queue", DISPATCH_QUEUE_SERIAL);
dispatch_group_notify(group, dispatch_get_global_queue(QOS_CLASS_(SOMETHING), 0), ^{ ... });
OR am I over thinking this? :) Thanks ahead of time, relatively new to iOS so just looking to learn/understand better.
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
Extensions
Notification Center
User Notifications