How can I share Safari URL to my Cordova/PhoneGap App (ios)? - ios

I am searching for the last week over many websites, and I can see people with the same question, but they are mostly misundestood.
What I have:
I have an iOS application that can receive URL from browsers (made with ionic/cordova)
What I want:
When I am on Safari (or other browser), i want to use the button Share, and my app appear there, in the list, just like Twitter, Facebook, etc. (I put an arrow in the image below).
Like this:
And, I want this working on many iOS versions.
So, I tried to change my app-info.plist many times and nothing works.
Somebody have a solution for this? Somebody have a info.plist that do this job?
(PS: I don´t want to use URL scheme, links, etc... Its the browser SHARE)
Thanks!

The only way is to create a share extension, as mentioned. It is not a trivial task in that you have to incorporate a lot of pieces together to make it work. Also, it is only supported on iOS 8+, which I guess shouldn't be a major issue at present.
In a nutshell:
Create Share Extension in XCode
Create a JS preprocessor
Add plist key/value pairs for related ExtensionAttributes
Set up custom URL scheme
Customize ShareViewController
Set up global handler function to perform your desired actions in app
See Cordova: sharing browser URL to my iOS app (Clipper ios share extension)
Or https://www.inshikos.com/blogs/76/dev/link-and-photo-sharing-to-a-cordova-ios-app-via-share-extensions-ios-8 that expands it further to include photo and wider share scenarios.
And, yes, a terribly misunderstood question with many false positive answers in other posts.

Related

How can I share a url from a browser to my app in iOS?

TL/DR
How can I make an iOS app appear on share sheet to receive shared urls from any other app?
This is a super newbie post as I have never really touched swift to develop anything, but I couldnt find the answer to my question on google so i wanted to start here. Almost everything I found by googling around is UIActivityViewController which appears more to be about how to share content from my app to another app; while what I am trying to do is share urls from another app to my app.
I am try to build a simple app for ios (doesnt have to be old version compatible because it will be only used by me) that can be a receiver for shared urls from apps like safari, brave or youtube. All the app does is when user clicks on the share button, and then chooses the app, the app gets the relevant data that is being passed, and then posts it to a backend server.
I can accomplish this on my android app/devices with an intent filter action android.intent.action.SEND in the manifest, and then listening for it with Intent intent = getIntent() in my method.
Would someone be kind enough to point me in the right direction at what I should look into (google about). If you can also point me to some sample code examples on how to write an app that can be the receiver for shared data (like urls), that would be fantastic. I am not sure what to search for so that my app can show up on share sheet, and how to then react with the data.
Again, apologies for the super noob question, but I couldnt translate my idea to something relevant on google.
It can be achieved by an Action Extension. Search for it.
Here is one:
https://code.tutsplus.com/tutorials/ios-8-how-to-build-a-simple-action-extension--cms-22794
I think both Share extension and Action extension can do the job. It depends on your needs.
Check this table to make sure which one is more appropriate for your purpose.
You can refer to App Extension Programming Guide by Apple.

Siri Shortcuts: How do I create a UI for the intent parameters of an iOS shortcut?

I'm trying to create an INIntent to be set up with the new iOS Shortcuts app in iOS 12. I have read the documentation and watched the apple video about it.
I have managed to set everything up and the shortcuts work well, however I can’t seem to figure out how to make customizable options that the user can edit when setting up the shortcut. An example of this would be how the Calendar app’s shortcuts are set up:
Notice the options for Get, Add Filter, Sort by, etc..
I know I can add parameters to the intents in the Intents.intentdefeniton file, but those parameters needs to be set from the app itself before the interaction is donated to the iOS system via SiriKit.
Regardless of what I do the Intent just shows up empty without options.
Any help is appreciated!
I am sorry to bring you bad news, but there is no way to do that. The apps that appear there (like Trello, Overcast, Pocket, etc...) were already supported by Workflow.app before Shortcuts.app was released.
You can try to work around it by calling URL Schemes directly but it might not be the solution you are after.
I think you need to create an Intents UI Extension for this.
https://developer.apple.com/documentation/sirikit/creating_an_intents_ui_extension

How to change iOS share feature text for my App?

I am looking for a way to dictate how my app is displayed in the iOS share feature window.
Currently opening the share feature from a different app (like Notes) will display my app with text that reads "Copy to ". I'm looking to change this to something like "Open with " or "Import to ".
The developer API pages do not seem very good though, and I have not been able to find a great answer. I imagine its some property in the info.plist, established upon installation, but I can't find out what that property might be.
Has anyone here done something like this before?
Attached image just grabbed off Google to show the text I'm talking about:
image of text
You need create a Share Extension for you App, the sharing extension allow you to share text, urls, images and videos to you app
This post can help you to get the solution that you need
https://hackernoon.com/how-to-build-an-ios-share-extension-in-swift-4a2019935b2e

How to open my iOS App with custom URL scheme in Swift 3?

I need to open my particular UIViewController when the following link is clicked on the Safari browser:
http://my.sampledomain.com/en/customer/account/resetpassword/?id=24&token=8fbf662617d14c10f4a11f716c1b2285
When this link is clicked on the browser, I need to open my application on a particular screen and retrieve the data from this url. For example:
id = 24
token = 8fbf662617d14c10f4a11f716c1b2285
...and pass it to that particular UIViewController.
How can i do that?
What you are describing is called Deep Linking. It's a very common app feature to implement — most apps have it — and conceptually, it seems like an easy thing to build. However, it's complicated to get right, and there are a lot of edge cases.
You basically need to accomplish two things:
If the app is installed: open the app and route users to the correct content inside it.
If the app is NOT installed: forward users to the App Store so they can download it. Ideally, also route users to the correct content inside the app after downloading (this is known as 'deferred deep linking').
While not required, you'll also probably want to track all of this activity so you can see what is working.
If the app is installed
Your existing custom URI scheme fits into this category. However, Apple has decided that custom URI schemes are not a good technology, and deprecated them with iOS 9 in favor of Universal Links.
Apple is right about this. Custom URI schemes have a number of problems, but these are the biggest:
There is no fallback if the app isn't installed. In fact, you get an error.
They often aren't recognized as links the user can click.
To work around these, it used to be possible to use a regular http:// link, and then insert a redirect on the destination page to forward the user to your custom URI scheme, thereby opening the app. If that redirect failed, you could then redirect users to the App Store instead, seamlessly. This is the part Apple broke in iOS 9 to drive adoption of Universal Links.
Universal Links are a better user experience, because they are http:// links by default and avoid nasty errors. However, they are hard to set up and still don't work everywhere.
To ensure your users end up inside the app when they have it installed, you need to support both Universal Links and a custom URI scheme, and even then there are a lot of edge cases like Facebook and Twitter which require special handling.
If the app is NOT installed
In this case, the user will end up on your http:// fallback URL. At this point, you have two options:
Immediately forward the user directly to the App Store.
Send the user to your mobile website (and then use something like a smart banner to give them the option of going to the App Store).
Most large brands prefer the second option. Smaller apps often go with the first approach, especially if they don't have a website.
To forward the user to the App Store, you can use a Javascript redirect like this:
<script type="text/javascript">
window.onload = function() {
window.location = "https://itunes.apple.com/app/id1121012049";
};
</script>
Until recently, it was possible to use a HTTP redirect for better speed, but Apple changed some behavior in Safari with iOS 10.3, so this no longer works as well.
Deferred deep linking
Unfortunately there's no native way to accomplish this last piece on either iOS or Android. To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do.
Bottom line
Deep linking is very complicated. Most apps today don't attempt to set it up by building an in-house system. Free hosted deep link services like Branch.io (full disclosure: they're so awesome I work with them) and Firebase Dynamic Links can handle all of this for you, and ensure you are always up to date with the latest standards and edge cases.
See here for a video overview an employee at Branch made of everything you need to know about this.

Is it possible to get info on other installed iOS apps?

Is it possible to read the contents of another application installed on an iPhone? What about from an extension or keyboard?
I'm trying to come up with something that 'checks' other apps to see if they have any deep links (like Twitter's Twitter://timeline that takes users straight to the timeline in the Twitter app).
Is there any smart way to check a given app for deep links?
Is it even possible to peek at another app's contents from within my app? I suspect no.
If no, what about making a keyboard or extension of some sort that I can access from an app like Twitter and see its contents, such as a URL deep link?
You don't have much options, you may use -canOpenURL:, but, since iOS9, must include special credentails listing all the custom schemes you want to check.
You can't read other app's contents on a non-rooted device unless this app is sharing a keychain (so it can exchange data via the shared keychain). The same thing goes with extensions.
iOS has some high bars on security, so, don't expect much or even, anything.
Something you may want is IntentKit. Also there are ideas around the web about standard url query format like MobileDeepLinking.

Resources