Re: Background fetch with localNotification
Re: Background fetch with localNotification
- Subject: Re: Background fetch with localNotification
- From: Quincey Morris <email@hidden>
- Date: Wed, 02 Sep 2015 03:25:24 +0000
On Sep 1, 2015, at 07:54 , Diederik Meijer <email@hidden> wrote:
>
> What I’m not sure off is whether I need to place this call inside a dispatch_async(dispatch_get_main_queue(), ^ { }) block, or not?
I don’t know the answer, but since no one else has jumped in with facts, I’ll venture an opinion.
It seems very likely to me that you don’t need to do it from the main thread. The notification itself is presented by a completely different process (I assume), so it’s probably hopped across a couple of dispatch queues before it got there. That means it’s *not* a case of your app modifying UI from a background thread, which is what you normally are being careful of.
In addition, the documentation states that you don’t need to retain the notification after return from the presentation method. That tends to reinforce the idea that it’s thread safe (at least it does in my mind, although it doesn’t prove anything).
OTOH, I don’t see a downside to dispatching via the main thread if you’re worried. Well, not unless you’re planning to *block* the main thread before the notification can go out. ;)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden