gpt4 book ai didi

iphone - performFetchWithCompletionHandler 只会被调用

转载 作者:行者123 更新时间:2023-11-29 10:55:33 25 4
gpt4 key购买 nike

这是我的应用委托(delegate)

 (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:2];

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
UINavigationController *nav=[[[UINavigationController alloc]initWithRootViewController:self.viewController ] autorelease];
nav.navigationBar.hidden=YES;
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"########### Received Background Fetch ###########");
//Download the Content .

[self sometask]; // i want to do some task here but this method get called only ones when i try to launch application

//Cleanup
completionHandler(UIBackgroundFetchResultNoData);

所以问题是 performFetchWithCompletionHandler 只被调用是的,我已经完成了所有在信息 pList 中的获取和所有但没有帮助请提出一些建议

最佳答案

请注意,只有当系统告诉您执行后台提取时,才应调用此方法。

您可以在此处的 Xcode 中模拟它:

enter image description here

关于iphone - performFetchWithCompletionHandler 只会被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18579372/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com