Tag: 后台处理

AFNetworking 2和后台任务

由于新的iOS7 NSURLSession后台请求,我有一个关于AFNetworking 2和后台下载/上传的问题 这是由我的AFHTTPRequestOperationManager自动处理? 它是否会自动将我的请求激活设置为背景模式? 我看到AFURLSessionManager有一个setDidFinishEventsForBackgroundURLSessionBlock方法,但我不知道是否一切都是自动的? 如果我的应用程序被杀害或暂停,请求将继续? 当我的应用程序重新启动时,如何获得callback? 非常感谢你的帮助!

IOS报亭背景故障排除

我正在开始一个报摊应用程序,首先我要testing所有的框架,看看谁的一切正常。 我已经在前台下载了通知触发的问题。 但我不知道如何在后台下载,或者至less我失去了一些东西…这是我添加到plist的东西: 该应用程序的目标是IOS 5 …这是我的代码…当然,我也实现了NKAsset的三种URLConection方法NKAssetDownload – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([launchOptions objectForKey:UIApplicationLaunchOptionsNewsstandDownloadsKey] || [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { NKLibrary *nkLib = [NKLibrary sharedLibrary]; for(NKAssetDownload *asset in [nkLib downloadingAssets]) { [asset downloadWithDelegate:self]; } }else{ [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeNewsstandContentAvailability )]; } [[NSUserDefaults standardUserDefaults]setBool: YES forKey:@"NKDontThrottleNewsstandContentNotifications"]; [[NSUserDefaults standardUserDefaults] synchronize]; return YES; } […]

iOS背景获取时间限制崩溃

我已经设置了背景获取,使用NSScreencast第92集的轮廓。 – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { … [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; … } – (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if ([[MyAppAPIClient manager] reachable] && [[Session manager] userSignedIn]) { [[[Session manager] user] fetchBackgroundWithSuccess:^(NSURLSessionDataTask *task, NSDictionary *responseObject) { completionHandler(UIBackgroundFetchResultNewData); } failure:^(NSURLSessionDataTask *task, NSError *error) { completionHandler(UIBackgroundFetchResultFailed); }]; } else completionHandler(UIBackgroundFetchResultNoData); } 对于fetchBackgroundWithSuccess:failure方法,我正在使用AFNetworking NSURLSessionDataTask 。 不幸的是,有时我得到错误 MyApp[3344] has active […]