我使用ASIHTTPRequest在iPhone應用程序在後臺運行時下載多個文件。隊列結束時,我想提供一個UILocalNotification
。 以下委託方法不叫,直到應用程序恢復:ASINetworkQueue完成所有請求時如何顯示UILocalNotification?
- (void)queueFinished:(ASINetworkQueue *)aQueue
{
NSLog(@"Queue finished");
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = NSLocalizedString(@"All downloads completed");
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
[localNotification release];
}
}
所以,我怎樣才能使這個通知出現在哪裏?
對不起,但這個答案太泛泛,並沒有解決我的具體問題。我知道如何顯示本地通知。我猜爲什麼委託方法不在後臺調用的原因是因爲它是用'performSelectorOnMainThread'調用的。 – Felix 2011-05-06 16:17:31