iOS9 Safari content blocker extension not invoked - ios

I'm playing with XCode7 beta, trying to test the shiny new "Content Blocker Extension". The example class is adopting the same NSExtensionRequestHandling protocol as the (already known) Sharing extension. The essential difference from Sharing extension is that the class is a plain NSObject, not a *ViewController subclass because, you know, a Blocker Extension isn't supposed to be showing any UI feedback. That's my understanding at least. Anyway the crucial method beginRequestWithExtensionContext which is supposed to feed the blocker declaration JSON to the extension point, does not get invoked. The extension does have TRUEPREDICATE as its NSExtensionActivationRule and Safari does acknowledge the existence of my host app in the new Safari config "Content Blockers". But still no cigar.
Does anybody know if it's even supposed to be already working this early in the beta or was it just a press release?
And, oh, while we're at it, is there any documentation of that declarative JSON format or it's just my Google-Fu failing me? :)

How do you know the extension isn't getting invoked?
I built a very quick test app and did a simple NSLog() from the beginRequestWithExtensionContext method and it was getting called when the extension was switched on.
Also, fwiw, there's +[SFContentBlockerManager reloadContentBlockerWithIdentifier:completionHandler:] which lets you trigger an update from the main app, at will.

There isn't any documentation yet, but I found that some characters in the url prevent the load of the JSON
They are (the one I found, might be more): +(as prefix) , $, |, ^

Is there any documentation of that declarative JSON format
The webkit.org blog post below seems to be the current best "official" documentation of the Content Blocker JSON format.
https://www.webkit.org/blog/3476/content-blockers-first-look/

Use the device console to view a live log of the device. There you will see your NSLog() calls.
Choose Window -> Devices from the Xcode menu.
Choose the device in the left column.
Click the up-triangle at the bottom left of the right hand panel to show the device console.

Related

Intent does not appear in Supported Intents

Link to all the code I'm working with so far: https://github.com/banool/respose.
I want to make an app where it is possible for users to activate some intent it defines as an action in response to some event in the iOS shortcuts app. For example:
If I open app X.
Run intent from my app instead.
I've seen this done before in other apps, so I know it's possible.
I have an intent defined (see attached code as well as image) that seems to be correct as far as I can tell. I don't think I need an intent extension because I don't intend to handle the intent in the background or via Siri.
I notice that when I try to add an intent under My Target -> General -> Supported Intents, the dropdown doesn't show my intent, only the built in system intents.
I'm not sure what I'm doing wrong here. I got to this point just by following the official guide from Apple: https://developer.apple.com/documentation/sirikit/adding_user_interactivity_with_siri_shortcuts_and_the_shortcuts_app.
I don't think the fact that I'm using Flutter should matter so much right now (I figure that's more of a concern for when the app actually opens up from the shortcut), but perhaps I'm wrong.
I have registered the app on App Store connect and I'm using an identifier that has the sirikit capability enabled. I've also added the "Siri" capability in XCode. I've tried this on both a simulator and a real device, the results are the same.
Any help would be much appreciated, thanks!
Had the same issue.
It seems that you can just type the class name without prompt, and it should work just fine. Don't forget to select proper target though

IOS share extension to launch parent app as chrome extension does

Looking to find a solution where I can launch parent app using IOS extension, some says it's not possible but chrome extension does it. Like clicking a url and opening it into my app.
https://developer.apple.com/documentation/xcode/allowing-apps-and-websites-to-link-to-your-content
https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app
Make sure you pay close attention to security as noted in BOLD RED.

Open Container App from Share Extenion

So I've found that the you cannot open URLs (and therefore deeplinks) from Share Extensions in iOS. But I'm wondering if there is any way to open the container app of the extension.
For instance, in my app the share extension will only work if you are logged in, so if you tap the extension it will present an alert view telling you so. But I want a button on that alert view to bring you into the container app to make it easier to log in.
Hope this makes sense and thanks in advance!
No, Apple does not permit this. It's not an accident that you can't open URLs from share extensions. There have been workarounds in some versions of iOS, but Apple has closed them, because they apparently considered them to be bugs. The intended behavior is apparently that a share extension must be able to do whatever it needs to have done without relying on the containing app.

iOS Today Extension: can this be dynamically enabled and disabled from within my app?

By default, a today extension appears in the extension list for my app as soon as the app is installed.
What I'd like to know is - is there a way, documented or undocumented, that this can extension be enabled or disabled dynamically? By disabled, I mean that it won't even appear in the list of extensions if the user tries to add it.
Hacky answers are OK if necessary, I'd really like to be able to do this.
It doesn't look like it. The exact mechanism for populating that list is not documented, but it appears that if an app bundle contains a valid, properly signed today extension, that extension appears in the user's list.
To make it disappear then, you'd have to somehow rename or move the extension bundle, or break its code signature. That might be possible with a jailbroken device, but otherwise you can't modify the contents of your app bundle at run time.

How to create a HTML link to a build.phonegap app?

I have run into several problems with iOS development through phonegap recently, and unusually people around here have been unable to discuss these issues and even together we have (for the first time I have ever seen) not had a single comment or answer for these topics...
See https://stackoverflow.com/questions/14707936/make-a-page-that-redirects-back-to-ios-phonegap-app and iOS broswer data -> Cache & Cookie for Phonegap App / Session?...
However, I have found "solutions" to get around these, but its by no means answers to the issues in question which are still outstanding... just simply doing it a completely different way.
However, despite loosing web-view in phonegap, in an attempt to get around https://stackoverflow.com/questions/14707936/make-a-page-that-redirects-back-to-ios-phonegap-app I now have some issue that are outstanding...
I need to be able to navigate back to my App from the web-system !!!
However, I have no idea how. I have read info on creating URL Schema, but I am not sure if this is even possible through build.phonegap at all... and it seems faily complicated. Does anybody know of a way for iOS safari to do one of two things
Either
Open the app that is running in the background
or
close the current browser tab and navigate back to the app in the background.
The closing tab idea would be good, but not essential
Look forward to everyone thoughts and opinions on this one...
Henry
You can create an url scheme for any application you make yourself.
See tutorial here
It's not as terribly complicated as one would think, and the required objective-c code is minimal.
Once you have done this, you can use your own url scheme to launch your phonegap application from safari with a hyperlink.
This would not close the tab (you could do this with javascript if you wanted to)
but does put safari in the background, and opens your phonegap app.
(whether it is already running in the background or not)
It is even possible to pass data to the app using your url scheme.
It is not currently possible using PhoneGap Build in 2.2 and previous. Potentially a feature top be released in newer versions of Cordova/Phonegap

Resources