We have an ad partner that is redirecting users to the app store after an ad in our app is tapped. We load an in-app browser which does the redirect. Nothing in the browser ever loads, it is just a white screen. Once the user returns to our app they are looking at that empty browser. Is there anyway to dismiss or close that browser once the redirect is completed?
We don't have any control over the server side.
What kind of in-app browser you are using in your app? Like a library or an UIWebView? If it's an UIWebView, there's a callback method when the webpage is loaded (and probably, redirected the link):
- (void)webViewDidFinishLoad:(UIWebView *)webView;
If you're using a library, I'm pretty sure it also has a method like that.
I fixed this by skipping the in-app browser and used Safari instead. App store re-directs are happening without showing the browser window and all the other ads are working as expected.
Plus I got to delete a bunch of old code.
Related
I have an app that logs you in via opening safari and redirecting you back to the app - however on "Log out" I need to open safari in order to log you out - is there a way to do this in the background instead?
For Log in:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[DataService loginURL]]];
However, I would like to not have to do the same for Logout - and simply get safari to run in the background or something similar. The problem is that the cookies are saved, and I need to get rid of them. Can I get safari to open a website without having to open Safari through the application?
Can you open Safari in the background? I'm pretty certain that the answer to that is no. In any case, if your main concern is to delete the cookies then you may not get the chance - the user could just kill the app, and the cookies would sit in Safari.
Is it an option to use a UIWebView or WKWebView to perform authentication? So rather than taking them off to Safari, the user would see the browser content actually inside the app.
That might improve the user experience, and you'd get a lot more control. For example, you could point the web view to your log out url when the time came for it. That might save you some cookie hassles too.
Besides which, I think openURL: is now deprecated because it was involved in some shenanigans.
We have an app that is meant to be invoked from the Safari via URL Scheme. Since the iOS 9 update we keep getting a "Open this page in appname?" dialog. Previous the update, the app would simply open from the Safari without any kind of dialog.
Is there any reason this is happening now and any way to avoid it?
To avoid the alert, you need to avoid print a page (html) between the tap of the user and the store, if you use a link to your servers and then a 302 should work. But if you need to do this from javascript there is no way no avoid the alert opening, Apple did this to prevent those spammy banner that with javascript opens the store. If you still need to use html+javascript before the store redirect there is a way force the app store to open and it's overwriting the location of the page, the alert will appear anyway during the transition. Try something like this
window.location = {deep-link};
setTimeout( function() {
window.location = {dummy-page}; // the faster the better
},10);
The bad news my friend about this workaround, is that it works in iphone 6 but not in <=5
We have an App that accepts donations and per Apple's guidelines (item 21.2) we can't do this in-app, it must open a webpage in Safari to perform the donation. We've got that bit working fine, and we can actually automatically invoke the App post donation and put the user right back where they left off. The trouble is that the Tab in Safari persists when the user returns to Safari later.
Is there a way to open an app from a webpage while simultaneously closing said webpage in Safari?
So apparently the way to do it is via Javascript. You can set the window location and then immediately close the window.
e.g.
window.location = "myapp://?stuff";
window.close;
I am running into a situation which I am not sure is possible from technical/design point of view. Please advise.
Here is what I need:
I have an open URL registered for my native iOS app. I expect a request ID to be passed along with it and once hit I open that request.
From within my native iOS app, I need to open a web page in the webview. This page has few buttons in it.
A tap on the button in the webview should open the request inside my app. So, I want to trigger the registered open URL in step #1.
Web page data is dynamic and will change on the fly.
Is this a feasible design. Shall I consider something else.
Any advise/pointers will be appreciated.
This should be possible. Here's a though:
1: Implement the UIWebview delegate method shouldStartLoadWithRequest.
2: when you intercept that your webview is attempting to access the url yourapp://blah-blah-blah you can return NO instead dip into your appdelegate can manually call the function handleOpenURL.
I've seen something similar in the past with supporting oAuth (I believe it was with instagram) within one of our apps. We basically loaded up the login page in a UIWebview and then when we detected the the post login redirect we parsed the oAuth token from the url and called it good.
Good luck
I'm not a heavy coder here, so i'll ask my best.
We made a brochure about our home town. However users spreading it trough facebook cant open the links when in their facebook app. The app does not send it to safari either. If opened directly from safari it is no problem.
The link is http://visit.lodingen360.com
Is there anything i can do to the site/index.html/whatever that will make it open in safari when the link is clicked in the facebook app for ios? (that won't affect visiting the site from pc's and so on)
Is there anything uiwebview won't read that can force it to safari, so that we can redirect from the thing opened in safari to the site?
Your page will load and display in Mobile Safari, I tried with UIWebView and it will load without displaying an error, but the brouchure page content won't display.
Safari and UIWebView have different user agent's - therefore my guess is that because your site uses flash but it checking for the type of browser you are not performing the check correctly for UIWebView and the page is attempting to use flash which isn't supported.