问题
open my app from background running on a specific timing..
want to do somthing like this
- (void)applicationDidEnterBackground:(UIApplication *)application
{
timer = [NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(timerFired:)
userInfo:nil
repeats:NO];
}
- (void)timerFired:(NSTimer*)timer
{
NSLog( @"yes it is running...");
PickUpCallViewController *call=[[PickUpCallViewController alloc]initWithNibName:@"PickUpCallViewController" bundle:nil];
navi=[[UINavigationController alloc]initWithRootViewController:call];
[[navi navigationController] setNavigationBarHidden:YES animated:YES];
window.rootViewController = navi;
[window makeKeyAndVisible];
}
回答1:
It is not possible to open programmatically app when you application in to background Mode. But using URL-scheme you can open App from browser.
You just need to set URL scheme as following screenshot:-
- First you need to open project-->Target-->info
- After this click on info you found at Bottom like this screenshot:
- Click on URL Type you got result like following screenshot:
- click on (+) and setting URL-Schemes as following:
Save and minimized your application by tapping Home button and open your safari browser. and just type mytestApp:// that you are setting before save as following screenshot:-
That all process working fine like:-
回答2:
i think its possible by using Remote notification(ios7 new background method) without showing uialertview interface.....
回答3:
As per iOS limitation we can't able to open any app without user interaction. If you need to open any app then you either force the user to do buy sending push notification where user could able to see your notification and can click to view the app.
Also for opening the app from another app or from a link then you can follow the URL schema method like Nitin Gohel explained above.
If you need to fetch a certain data without user interaction then you can use silent push notification which is commonly called as background fetch. You need to enable the push notification in the background mode and use application:didReceiveRemoteNotification:fetchCompletionHandler: method to handle inside the app. Also we need to make few tweaks in the server side while sending the push notification
aps { content-available: 1 alert: {...} }
There is lot more stuff available in net regarding background fetch and you can able to understand how it is working in the this link.
来源:https://stackoverflow.com/questions/23632405/is-it-possible-to-open-running-background-app-on-in-objective-c