2011-12-06 2 views
-1

저는 iPhone을 처음 사용합니다.iPhone 앱에서 10 개의 이미지를 서버에 업로드하는 방법은 무엇입니까?

iPhone 응용 프로그램을 만들었습니다. 이 응용 프로그램에서는 서버에 둘 이상의 이미지를 업로드하는 옵션을 제공해야합니다. 사용자가 응용 프로그램을 닫았다 고 가정하면 모든 이미지를 백그라운드로 업로드해야합니다.

나는 이것을 수행하는 방법을 모른다. 제발 이걸 제안 해주세요.

감사합니다.

답변

0

당신은 그렇게 할 수 없습니다. 백그라운드 모드는 그런 종류의 프로세스를 허용하지 않습니다.

NSUserDefault에서 이미지 경로를 저장하고 다시 시작할 때 NSUserDefaults에 응용 프로그램을 다시 시작

+0

당신이 말해 주 시겠어요? – Alex

+0

알람 앱 사용 UILocalNotification http://developer.apple.com/library/ios/#documentation/iphone/Reference/UILocalNotification_Class/Reference/Reference.html 기능과 유사한 cron입니다. –

+0

http://developer.apple.com/library/ios/#technotes/tn2277/_index.html 배경 콘텐츠 다운로드/업로드를 위해 원하는 것을 할 수 없다는 것을 설명 할 수는 없습니다. –

0

이미지 저장

[[NSUserDefaults standardUserDefaults]의 setObject : UIImageJPEGRepresentation (이미지 1) forKey : @ "이미지"];

는 NSUserDefaults

에서 읽기

을 NSData imageData의 * = [NSUserDefaults standardUserDefaults] objectForKey : @ "이미지"];

UIImage * image = [UIImage imageWithData : imageData];

0

UIApplication-beginBackgroundTaskWithExpirationHandler:에 대한 참조를 확인하십시오.

여기에 기본 예제입니다 ... 응용 프로그램의 알람 종류가 작동하는 방법을

- (void)applicationDidEnterBackground:(UIApplication *)application 
{ 
    // self.backgroundTask is a property on the app delegate. 
    if (self.backgroundTask != UIBackgroundTaskInvalid) // A background task is still in process. Bail early. 
     return; 

    __weak AppDelegate *weakSelf = self; // Create a weak reference to self to avoid retain cycles 
    self.backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{ 
     [application endBackgroundTask:weakSelf.backgroundTask];   
     weakSelf.backroundTask = UIBackgroundTaskInvalid 
    }]; 

    dispatch_async((DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 

     // Kick off task to upload photos here. 

     [application endBackgroundTask:weakSelf.backgroundTask]; 
     weakSelf.backgroundTask = UIBackgroundTaskInvalid; 
    }); 
} 
관련 문제