0

I have an app that works in background successfully. It also has a working URL scheme set up and running.

Now I need to implement the following scenario - after 5 seconds in background I want the app to open itself up - and make it a foreground one.

The public method doesn't seem to work from the app: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"shdServer://"]];

Is there any private API to return to the app from the background? Or is it impossible at all on iOS?

Publication on the AppStore is not needed

Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
  • I sincerely doubt Apple would pass an app into the AppStore that could make itself come to the foreground. That would be so abusable. – Almo Jun 11 '15 at 17:47
  • I **don't** need publication in the AppStore – Sergey Grischyov Jun 11 '15 at 17:48
  • 1
    It doesn't fit with the whole iOS philosophy. I'd be seriously surprised if an App could promote itself to foreground from the background. – Almo Jun 11 '15 at 17:49
  • @Almo Do you know it's not possible or only think so? This question isn't a philosophical question - it's the one to solve a particular problem – Sergey Grischyov Jun 11 '15 at 17:51
  • If I knew for sure, I'd put it as an answer. Hence it being just a comment. – Almo Jun 11 '15 at 17:53
  • 1
    There is no point in commenting about how AppStore apps work because question has "iphone-privateapi" tag. There're many things that don't fit in iOS "philosophy" but still can be done using private APIs. – creker Jun 11 '15 at 19:50
  • @SergiusGee, check out this answer http://stackoverflow.com/questions/30476982/how-to-open-an-app-by-bundle-id-on-ios#comment49036729_30476982 It has a link to sample project that can launch other applications by bundle id. I don't know whether it requires jailbreak to do it because only working way I know requires jailbreak. – creker Jun 11 '15 at 19:56
  • The public method doesn't work because AppStore apps can't call it from the background. It restricted only to the foreground. To call it your app needs special entitlement that can only be added on jailbroken phones – creker Jun 11 '15 at 20:01
  • @creker The link to the app from the answer worked! Make your comment an answer and I'll accept it. Thanks a bunch! – Sergey Grischyov Jun 11 '15 at 21:06
  • 1
    Ok, I'll explain a bit how it relates to your question so that other people would better understand the answer. – creker Jun 11 '15 at 21:24

1 Answers1

2

Answer here has a link to a sample project that can launch applications by their bundle ID. In your case you can give it bundle ID of your app and it will bring your app to the foreground. You don't need to jailbreak your device to use it.

Community
  • 1
  • 1
creker
  • 9,400
  • 1
  • 30
  • 47