Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Mobile Safari without using openURL:url

I want to open the Mobile Safari app "WITHOUT" changing its currently displayed page.

I can easily switch to Safari using ..

NSString *ourPath = @"http://www.google.co.uk";
NSURL *ourURL = [NSURL URLWithString:ourPath];
if ([ourApplication canOpenURL:ourURL]) {
    [ourApplication openURL:ourURL];
}

But what I want to do is just switch to safari and not navigate away from the page it is currently on. Like when I switch using the task switcher, it just pops Safari and leaves it on the page it was.

I've tried sending it a url of @"http:" but this doesn't work it changes pages to to "http:localhost/"

Is there a way to just Open it?

Plasma

like image 721
Plasma Avatar asked Oct 23 '22 18:10

Plasma


1 Answers

I solved this using the answers on this page ..

iOS How can I use UIApplication launchApplicationWithIdentifier which is in private APIs?

Though I didn't have to move my .app file in to /Applications

It was enough to add the entitlements, then simply call it using ...

[[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.apple.mobilesafari" suspended:NO];

Plasma

like image 170
Plasma Avatar answered Nov 03 '22 00:11

Plasma