비누 기반 웹 서비스를 사용하여 이미지 업로드를 실행하려고하며 내 앱에서 2 가지 주요 문제에 직면하고 있습니다.비누 기반 웹 서비스를 사용하여 서버에 여러 이미지 업로드
문제 1 : - 서버에 내 응용 프로그램이 그 당시보다 배경 상태로 간다면 그 시간에 여러 개의 이미지를 업로드 응용 프로그램 내 (application suspended state)
실행 중지됩니다. 내 앱이 백그라운드에서 전경 상태로 돌아갈 때 내 배경 스레드를 다시 시작합니다.
2 호 : - 장치 갤러리에서 서버에 160-170 개의 이미지를 업로드하려고합니다. 서버에 60-70 개의 이미지를 업로드 한 후 메모리 경고를 받았습니다. 그 방법을 처리하고 응용 프로그램 내에서 일부 메모리를 비우려고하고 그 시간에 내 스레드가 다시 시작되면 응용 프로그램이 다운됩니다. // - >> - 2 호 문제에 대해 3 개의 다른 웹 서비스와 너무 긴 코드를 추가하여 여기에서 공유하지 않을 것입니다. 내가 악기를 점검 할 때 일반적으로 최대 2에서 2.5 MB의 라이브 바이트로 실행되지만 스레드를 업로드하면 점차 증가하고 일부 선택 지점에서 수신 된 메모리 경고가 수신됩니다. 내 코드는 ARC의 기능을 포함하지만 여전히 메모리 경고 문제가 있습니다. 문제 1
은코드 : -
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIDevice* device = [UIDevice currentDevice];
BOOL backgroundSupported = NO;
if ([device respondsToSelector:@selector(isMultitaskingSupported)])
{
backgroundSupported = device.multitaskingSupported;
}
//NSLog(@"backgroundSupported: %d", backgroundSupported);
if (backgroundSupported)
{
_IsBackground = TRUE;
UIApplication* app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:
^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
// Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),
^{
while (_IsBackground)
{
//// it contineous run my application within this state.
}
NSLog(@"Background loop ended");
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}
}
도움 주셔서 감사합니다. – Anjan