简体   繁体   中英

how do i make my iphone/ios app open a safari window on launch

I have developed an IOS/Android app on the Apppresser platform with Phonegap BUILD. yes I'm a newbie.

There are a bunch of IOS issues. Some I've posted here before. The latest is about 1/3 of the Iphones basically crash installing this.

other issues are the links don't have "done/close" buttons on them when they open (as android browser does automatically and as safari does when it opens them in ios)

SO, I want to make an app that's basically a launcher. Well, keeping the push notification part of the app, which is the reason.

Ideally I'd like to sniff IOS, and if it's IOS, have it open the site's home page in Safari.

How?

Very simple....

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];

Add this line into your appdelegate...

EG:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com"]];
    [self.window makeKeyAndVisible];

    return YES;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM