1
我上傳視頻和圖像傳輸到遠程服務器,並使用下面的代碼將其轉換爲NSData的:如何轉換大尺寸的視頻和圖像到NSData的iOS中
ALAssetRepresentation *rep = [asset defaultRepresentation];
Byte *buffer = (Byte*)malloc(rep.size);
NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:rep.size error:nil];
//NSData *data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
NSData *imageData = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
對小規模的視頻和圖像,此代碼工作正常,但對於大視頻或圖像,應用程序崩潰。
感謝您的答覆哈桑,U可以共享任何代碼這一點。? – kingMaker