开发者

App crashes when I try to upload 600MB video to Facebook from IOS application

开发者 https://www.devze.com 2023-03-25 01:29 出处:网络
Im using Facebook iOS SDK to upload video from my iOS application to Facebook. I tried to upload 90MB video to Facebook using FBConnect Library from iOS application.

Im using Facebook iOS SDK to upload video from my iOS application to Facebook.

I tried to upload 90MB video to Facebook using FBConnect Library from iOS application. It uploaded successfully.

But when I try to upload a 600MB video, the app crashed - Program received signal "0" er开发者_运维知识库ror.

I'd like to know, is there any video size limitation to upload video using FBConnect library from an iOS Application?

Problem in Follwing method of FBVideoUpload.m class following method startUploadWithURL // App crashes because of NSData object. because NSData trying to hold 600MB video file data in single object.// params setObject:[NSData dataWithContentsOfURL:movieURL] forKey:[movieURL lastPathComponent]]; // App crashes in this line


Facebook's REST API video upload documentation says:

Each user is subject to limits on the length and size of the video files they can upload, just like they are when uploading through Facebook. Use video.getUploadLimits to determine a specific user's limits.

It's probably not the same API you're using, but I imagine the principle is the same.


I think you may want to look at encoding the 600MB video before you send it to Facebook, or at least compressing it heavily and pushing it down to one of your servers to do publish remotely. The iPhone may run out of juice before the download even finishes.

Alternatively you could split the captured video up into segments and upload them individually.


The exact reason why your app crashes, is that you're trying to put more MBs into memory than what's available. iOS reacts by shutting down your app. If you really need to be able to process such large files, you must find a way of processing it little by little.


Use the code mentioned:

NSData *movieData;  
NSError *dataReadingError = nil;        
movieData = [NSData dataWithContentsOfURL: movieURL options:NSDataReadingMapped error:&dataReadingError];        
if(movieData != nil)        
    NSLog(@"Successfully loaded the data.");   
else        
    NSLog(@"Failed to load the data with error = %@", dataReadingError); 
0

精彩评论

暂无评论...
验证码 换一张
取 消