동영상을 파일로 저장하고 nsstream을 사용하여 동영상의 청크를 읽고 전송할 수 있습니다. 전송 한 내용과 남은 내용을 기억해야하지만 상태가 좋지 않아야합니다. 예 :
BOOL done=FALSE;
NSInputStream *stream=nil;
NSString *[email protected]"..."; //your file path
stream=[[NSInputStream alloc] initWithFileAtPath:myFile ];
while(!done)
{
int chunkSize=500000; //500 kb chunks
uint8_t buf[chunkSize];
//reads into the buffer and returns size read
NSInteger size=[stream read:buf maxLength:chunkSize];
NSLog(@"read %d bytes)", size);
NSData * datum=[[NSData alloc] initWithBytes:buf length:size];
//when we actually read something thats less than our chunk size we are done
if(size<chunkSize)
done=TRUE;
//send data
}
ASIHTTPRequest와 같은 HTTP 라이브러리를 사용하고 계신가요? –
현재 ASIHTTPRequest를 사용하고 있지 않습니다. – akaru
나는 너 자신이 이것을하고 있다고 가정하고있다. 내가 생각할 수있는 유일한 다른 방법은 메모리 매핑 된 파일을 사용하는 것입니다. [this] (http://stackoverflow.com/questions/6172919/ios-memory-mapped-files-and-low-memory-scenarios)와 같은 –