Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Show UIAlert in Safari when using My App's Share Extension

I'm developing a simple content blocker for iOS 9+ devices. Everything seems to be working fine in terms of blocking ad's / trackers etc and I even have the ability to 'whitelist' websites directly from Safari using a Share Extension Action.

My question is when the user taps Action > My Apps Share Extension [which adds it to a list inside the main app] I want to show a simple Alert that says something like 'This site has been added to your whitelist..." for a few seconds and then disappear.

... how do I do this?

**UPDATE I have read all of Apples documentation on this but still can't figure it out. The post here does actually refer to how to design a streamlined UI but doesn't really cover my situation.

Hoping someone will know :-)

like image 366
Roksalt Avatar asked Sep 29 '15 22:09

Roksalt


1 Answers

Why you don't use Notifications for this , you can have your notification style set to show like an UIAlert. You can see something like that in Calendar app in iOS.

UPDATE:

I did a little bit more digging , it's not possible to change the style programmatically according to this. So the best choice is handling it when your app is in foreground. I can't think of any other OS wide solution other than local notifications.

like image 107
MKoosej Avatar answered Nov 14 '22 08:11

MKoosej