How to use UIWebView to display a website in an iPhone app? - ios

I am using UIWebView to open a link in my app and I submitted it to the AppStore which resulted in the rejection with reason of 2.12 of review guidline which says
2.12: Apps that are not very useful, are simply web sites bundled as apps, or do not provide any lasting entertainment value may be rejected
Is it because I used UIWebView to open a web site.

UIWebView are used to open the websites. But your application must have certain more features.
The application containing only a UIWebView to open a website is of no use as instead you can open the website directly in the Safari and in that open the Actionsheet from the bottom bar and tap on Add to Home Screen option. It will be same as the application you have tried to upload on Appstore.

It is not because you open a website with UIWebView, but it might be because your app does only that. Your app must do more that just that.

As far as my knowledge you are not providing any useful information i.e nothing is special in your app

Related

Installing iOS App Directly From Safari Web UI?

I was using a website, and noticed that from my iphone on Safari, I could directly install their app from the Web UI. This was from the top of the page at https://flytap.com/ . I can't find what this is called or how to do it anywhere in the iOS documentation. This only seems to work in Safari.
Does anyone know what they are doing, or how I can do it?
This is done via adding Universal Link support (documentation here).
The banner you are seeing is the Universal Link smart banner (documentation here).
In-short, you should have a website, the website should be SSL enabled, you need to add an apple-app-site-association-file which defines the links your app needs to handle, make changes in your app to handle Universal Links and you should be good to go.
The app you shared has its apple-app-site-association file here. You can view this file for any app that supports Universal Links using the pattern https://<SITE_BASE_URL>/.well-known/apple-app-site-association or https://<SITE_BASE_URL>/apple-app-site-association.

when my app is not intalled, iOS universal link in UIWebView will launch Safari?

From Apple's guide in Support Universal Links:
When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
But i'm confused that if my app is not installed,and I tap a universal link of my app in another app's UIWebView,will the system launch Safari app to load my website,or still load it in the UIWebView?
I test some app's universal links when the app is not installed,and they never launch Safari to load the next page ,they still load it in the UIWebView.
I want to konw if it's possible to launch Safari,but not stay in UIWebView.Do I need any configuration in apple-app-site-association file?
Actually I want to trace where my app was installed from by using cookie.I can store a cookie in Safari with informations of the download page,and get the cookie with SFSafariViewController when my app is installed and opened,and present different views according to the cookie.
What you are trying to build is called 'deferred deep linking'. This (plus a lot more) is exactly what we provide at Branch.io. If you want to avoid the headache of configuring it all yourself, give this a look. Apps like Pinterest, Airbnb, and Tinder all use us for this reason.
Apple's documentation is referring to the default behavior with the standalone Safari browser. Handling links inside an app with UIWebView supersedes this, and there is no way to automatically bounce out of the origin app into the main Safari app.
The workaround is to store data on your own backend. As you've discovered, relying on a cookie pass-through on the device itself won't work in many cases.

iOS custom smart app banner

I want to have custom view for smart app banner which I think is not possible. but I have seen it in wikipedia mobile site which is smaller than standard apple banner.
wikipedia shows custom banner on its mobile site only if wikipedia app is installed. if it is not installed or user uninstalls it then banner disappears.
Is there a way to achieve this kind of banners?
Are you talking about 'Open in app' banner? Those comes by default if you have supported for universal links in the app.
See screenshot:
For iOS6+, you can use Smart Banners: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
One of your requirement is to not show when the app is not installed (instead of promoting the app).
I do not know of a way to test for installation but I would look
url scheme: seems limited because the app will always open instead of
just being able to check if system can answer
cookies: can a cookie
be set from inside app that would be reused by safari when visiting
the same domain?
files: create a file from the app and try to open it
from safari

External Safari link or UIWebview?

Im creating an App which needs to link to a PDF which is stored online (its far too big to bundle with the app). Ive submitted the app to the AppStore, but it got rejected when I loaded the pdf into a UIWebview. So I changed this to loading it into Safari, but this also got rejected!
Does anybody know of an acceptable way of linking to a PDF on the internet from an App?
Addition
The reason from Apple for the loading in Safari is:
We found the following issues with the user interface of your app:
When tapping on various tabs, it opens a web page in mobile Safari.
I guess this might be the reason (Not sure):
If you refer App Store Review Guidelines, in that 2.12 says:
Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected.
So instead of opening that into Safari, try using a separate UIViewController with UIWebView in that. And open your pdf web link over there inside the application itself. Do not redirect user to Safari browser unnecessarily.
As per Apple report provided by you and Review Guidelines, I guess this might be the cause of rejection.
To make sure, you can comment over the mail which you have got with app rejection notification. And ask to Apple itself regarding the issue and solution as well. They normally do reply.

Is it possible to have an iOS webapp call another regular app to open? Works with Mobile Safari.

I am working with my web developers that are stuck on a problem with a Web-app we are creating.
The webapp works great, you add the website to your home screen on the ipad, open it and use the website within the webapp interface outside of safari.
The issue is that we have one function that doesnt work, where when clicking a URL link within mobile safari, it calls an external app (Optiscan- a qr code reader), and then when scanning the code, then returns you to Mobile safari.
The question is - is there a way to call a URL that will open an external app, from within a webapp? Similar to how it would work from mobile safari?
If so - i am then wondering if an app can be written that calls the webapp to open. For example if i needed the QR code reader to then re-open the web app and pass it the QR code.
-Dana
In iOS, native Apps can define Custom URL Schemes. If you know the scheme of an App, you can simply open it by clicking on a link like Launch Facebook App. This should launch the Facebook App for iOS if installed.
There was a crowd-sourced list of known URL schemes on akosma.com but they seem to have some problems and the list is not available as of writing this. If the URL scheme of the App you need to open is not public, try contacting the developer and ask for it. I'm sure if you ask kindly, he will help you ;-)
Edit: Almost forgot to say, opening Apps like this won't return to your Web-App magically. That's something the developer of said App would have to implement.
Edit 2: I found another website that has many custom URL schemes in it's database: http://handleopenurl.com. It does not have a URL scheme for Optiscan but for other QR Readers, maybe this will help you.

Resources