Instantly open Web Inspector for iOS WebView - ios

I'm developing an iOS app with WebView.
I need to debug is so that's what I do:
Open WebView on iOS
Go to desktop Safari -> Develop -> iPhone ->
The problem is some script takes place the moment WebView opens. So when I open Web Inspector all I see is just a blank page.
Is there any way to pause page processing before Web Inspector is opened?

For such cases, I would place a UIButton somewhere in the layout, and request the url, only when the button is pressed. That is you will have a WKWebView initiated and available in your screen and you only navigate to the url path on the tap event of the UIButton.
This is just for debugging purposes.

Related

In iOS, is it possible open a url in safari, then go back to the app and reopen safari without pushing a new url?

I have a simple app that opens a link in Safari with UIApplication.shared.open. The user might navigate to any number of urls in the site, and then hit the Back arrow in the top left corner as return to the app. Is it possible to launch Safari again, but without a new url, and simply open the tab at the same url location where navigation stopped, prior to pressing the back button? The only way I know to open Safari is to push a url it, which means a user cannot resume using a site in Safari where they left off. I would appreciate any ideas on how to implement this feature.

How create an iPhone app that just starts a website

How do I create an iPhone app that just starts a website in the default browser?
I'm not looking for a browser inside an app, just goto the pre-programmed website and close the app.
What do I need to get this accomplished?
What you're talking about is homescreen shortcuts you can create out of Safari. Unfortunately to have a native app that just starts the webbrowser is not possible.
Here is how you create a homescreen shortcut:
1. Tap the share button in Safari
2. Tap "Add to Homescreen"
3. Confirm or change shortcut title
4. Done. See the shortcut on your homescreen

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

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.

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.

Is it allowed to add a UITabBarItem that opens up Safari?

I want to add a UITabBarItem on the TabBar which when clicked opens up Safari instead of loading its corresponding tab. (Not UIWebView but the app goes to background and opens up Safari instead)
I already know how to do this, but I was wondering if this is allowed by Apple. I know they're OK with using the TabBarItem to trigger other actions such as opening a modal in the app, etc. However I am not sure if it's OK to open a safari.
I am just being cautious because I don't want it to get rejected for this and wait another week.
I don't see a reason why it shouldn't be allowed.
But: it could lead to confusion amongst your users, because they would most likely not expect that touching an item on the TabBar leads to an app switch. I would rather open a webView and offer the additional possibility to open the page in Safari.
There is no harm doing such and it is also allowed by Apple.
But, I would personally suggest to use UIWebView, over Safari navigation. Because it will create unhealthy user experience, where he/she requires to jump around to swith in-between Safari and App. Rather you can open the same link in UIWebView, which will kepp our user in app only.

Resources