How can I share a url from a browser to my app in iOS? - 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.

Related

How to work with Firebase App Indexing for IOS Apps

i am in the process of making my app with firebase i am pretty much done with that except Firebase App Indexing. I am very exited with this feature because it could help me to increase my app get more traffic from the web but the problem is i really can't able to see how to implement this. According to Firebase Docs i just need to register my app with this pice of code
[[FIRAppIndexing sharedInstance] registerApp:your Apple ID from iTunes Connect];
I have done that but what should i do after that?
1.My app is firebase app that means i don't have any website to host my content except firebase realtime database. Does my content is available for crawlers? if not how can i make available to them?
2.If i can able to show my content in the google search results i don't wanna show all the content and i wanna show just some of my content for example i have a social app for sharing General Knowledge questions, i wanna show just the question like "What is the highest mountain" in the search results and if the user want to see the answer it should take them to my app how can i do that?
3.As per docs i came to know that i need to create univiersal links for my app content to direct users from google search but how shold i do that ? Lets say should i crate universal links when the user create question?? if so how can i do that ??
Thank you very much for the help.
This is not currently possible on iOS using Firebase App Indexing. The situation is slightly different on Android, but that is not applicable to your question.
On iOS, Firebase App Indexing is simply highlighting pages on your website in Google search results that have corresponding content inside your app. This is achieved by piggybacking on Apple's Universal Links standard, and there is no proactive 'crawling' going on inside your app. This means unless you have a corresponding web page for your app with 1:1 content parity, you can't really benefit from Firebase App Indexing on iOS as it comes out-of-the-box.
The best workaround is to generate little 'placeholder pages' for every piece of content in your app, which the sole purpose of opening your app (if it is installed) or redirecting to the App Store (if it is not installed). Ideally you'll need some sort of deferred deep linking system so that users still see the correct content after downloading. Fun fact: this is essentially how HotelTonight operates their entire business model. Unfortunately Firebase's implementation is not mature enough to support this full flow, and Google hasn't quite figured out how to rank app-only content properly yet in search results so you will probably need to pro-actively submit your placeholder pages to them.
Shameless plug: at Branch, we provide all of the above as a free service. You can read more about it here and take a look at the set up docs here.

How can I share Safari URL to my Cordova/PhoneGap App (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.

Application inside another application in iOS

How do you import or display an application inside another application?
It is like, it will be a part of the app where you can use it's functionalities. Maybe in full screen or not in full screen. My thoughts are these are web based and is being opened in a UIWebView to use the functionalities.
Extensions? It's more like "piggybacking".
Here's an example:
https://hub.united.com/en-us/news/web/pages/uber-on-the-united-app.aspx
I'll post an answer regrouping my answer and also #Popeye one that seems valid too.
There may be a few ways to do it, each ones of them may act differently.
The other app offers a public SDK/API/WebServices
As an example, I'll take FaceBook API, that allow you to login giving you a UIViewController (that you can customise), and allowing you to ask for some data through their WebServices (like who are the friends, etc.). You're still inside your app.
The other app offers you a private SDK/API/WebServices
Same as the other one, but it more like a parternship. You're still inside your app.
URL Schemes
The other app gives you a few way to interact with it. They check if the app is installed, and launch it with some parameters, or if not, they may redirect it to the app in the Store, their website, etc. More info about URL Schemes from Apple Doc. You have to check their documentaion to know how to interact with it.

How to search the App Store programmatically and return App information

I would like to search the Apple App Store from within my app, and return App information such as Icon, Description, Name, etc.
I found some examples using URL's. But from what I understand, they cause your app to pause as it opens either the App Store or the browser. If I am mistaken, please may you provide me with an example on how to accomplish this (seemingly) simple task?
Regards,
Shane
I don't think there is an API available to do what you are describing directly in the iOS device. However, you could hack something together using the search API available from apple. Check it out at here. You could do this behind the scenes rather then using the browser. It's not a simple task, but it is doable. Besk of luck.

Possible to launch an iOS app from a web link

My app bounces the user out of the app into safari to do some web things (toying with using a webview but there are other concerns regarding layout, usage, re-launching the app, server errors, etc.). When they are done I would like a link on the final web page that lets them re-launch the app. I think this should be possible through a protocol implementation of some sort (such as href="myAppProtocol://relaunch") but I don't know how to go about implementing it properly.
[UPDATE] (can't answer my own question yet so editing here)
Stumbled across this just after posting (hours of looking and this is always how it comes together...) http://mobileorchard.com/apple-approved-iphone-inter-process-communication/
Using a URL type handler in your plist (as I suspected) you can declare that your app handles urls of that type (say "myAppProtocol"). iOS then launches your app and hands it the URL when it's touched in safari. What you do from there is up to you, I just need to launch so I don't take it any further, but you could grab the URL and parse it out for further passed information etc.
I guess you found the answer already, but have a look at the docs as well: Using URL Schemes to Communicate with Apps.

Resources