iOS app deep linking: Return to previous app or access current url scheme of current app - ios

I'm developing a custom keyboard for iOS. When I'm e.g. in Safari using my custom keyboard, I have a button in my keyboard to jump to to keyboard containing app. Then in my keyboard app I have the iOS specific "<- Safari" button in the top left corner to jump back to Safari.
Is it possible to programmatically jump back to the source application (in my example Safari)?
Or can I send the original url scheme to my containing app and then open the previous app (could be ANY) by the url scheme?
It must be somehow possible, because the app Scandit Wedge does exactly what I want. I created an empty test app without any url scheme and with the Scandit Wedge keyboard I can go to Scandit app, read barcode and it goes automatically back to the source app.
Here's a video I recorded:
https://www.youtube.com/watch?v=UiHH4NanlkA

To achieve this you have to implement inter-app two way communication using x-callback-url. x-callback is just a "protocol" to format the NSURL to ease the data processing at the receiver end and also allowed the source app to receive the correct callback function. You can explore more this with evernote and this tutorial.

Related

How to open the companion app and go back in from a keyboard extension in iOS

So, I have this requirement where a keyboard extension must be able to open it's companion app and have the user take a specific action in there and then be able to go back to whatever previous app was opened and input some text in the previously selected text field.
Basically, if you take a look at Scandit Keyboard Wedge you'll see that behaviour: the user opens can press the "Scan" button on the custom keyboard and is taken in the companion app. Once a barcode is scanned the app automatically goes back to the previous opened app and inputs the barcode string into the text field that was being edited.
Now, reading through Apple's documentation I see a mention saying that a keyboard extension is not permitted to open another apps. Does this include it's own companion app?
Also, even so, I'm not really sure how I can have the keyboard extension open a custom URL since UIApplication.shared is not available in the keyboard extension.
Now, my second problem is, how does the companion app go back to the previously opened app?
Same goes for Google's own custom keyboard. Now, I found a question about this one here on SO. The answer suggests that this is using a private API to handle this thing. But then I'm curious: how did this even go throw Apple's review process? Am I expected to have my app rejected?

How to dismiss iOS camera Access popup?

My app requests access to the iPhone/iPad camera. This results in the native iOS popup to appear, asking for user confirmation.
Is there a way in which I can dismiss this iOS popup (so before the user has made the OK / Don't Allow choice)?
For recent versions of iOS this popup automatically appears when you request write or read access for iOS Photo Library or use some of the AVFoundation framework components.
You can not dismiss it programmatically but you sure can create your own alert before showing the system one so you can have more control over what the user does.
It is the case in many 3rd party apps because when the user declines the access, it's not easy to ask them to go to settings and re-enable it from there. One of the easiest examples to implement would be something like this.

Possibility to stop opening Google Map app while clicking the logo

I am using Google Map in an iOS app built for a client. I know that the logo at the bottom cannot and shouldn't be removed at any time. I am wondering whether I can disable the click action and stop the app jumping or not, since the client don't want the app to open an external app.

Performing a task through a website and going back to an iOS app

I'm developing an iOS 7+ app that I need to offer the option of navigating to a certain web page to let the users to fill in a form there, and after that to come back to the app's view where the user was.
Is it possible to programmatically open Safari with a given url? If it is, I suppose that then there is no way to automatically redirect the user to your app from there... right? Is then a UIWebView the only option? Is it possible to navigate back or dismiss the view with the UIWebView without the need of user interaction?
Thanks
You can open links in Safari as detailed in this post How to launch safari and open URL from iOS app
I don't believe you can set a 'callback' and have it return to your app on completion, as you have no control over the user once they have exited your app's sandbox.
Opening the link in UIWebView would provide control, as you can utilize the UIWebView callbacks.

How to send a URL string / web request from a button pressed in an IOS application

I would like to remote control my Sonos System as well as my home automation system with my old IOS devices I do not use anymore. I have in multiple rooms multiple devices installed, so I'd like to develop per room a separate screen, which allows me to execute certain functions.
For instance in my garden I'd like to turn on the radio, change volume, change radio station switch on the light, dim the light.
I would like to have one screen showing me several buttons as well as slider.
Button1 labeled "mute" shall mute the Sonos system by calling a URL:
http://myphpwebserver/pagetocontrolsonos.php?mute=true
Button2 labeled "louder" shall mute the Sonos system by calling a URL:
http://myphpwebserver/pagetocontrolsonos.php?louder
and so on ....
The php page does not provide any feedback, but only calls the Sonos.
The PHP page is already developed and works fine. I just want to have native buttons in a native iPhone app.
In addition calling the Sonos I'd like to call my Home-Automation System to switch an dim ma light.
Slider1 labeled "light" shall call a URL from Home-Automation Server based on slider setting.
In case slider is set to the middle it shall call:
http://myhomeautomationserver/lamp.php?dim=50% - while 50% is the slider setting.
What do I need to perform to call a URL from a button or a slider?
Can someone help?
You can use NSURLConnection to send URL requests. Have a look at this tutorial for an introduction on how to do so.

Resources