当我尝试从 IOS 应用程序上传 600MB 视频到 Facebook 时,应用程序崩溃
我使用 Facebook iOS SDK 将视频从我的 iOS 应用程序上传到 Facebook。
我尝试使用 iOS 应用程序中的 FBConnect 库将 90MB 视频上传到 Facebook。 就上传成功了。
但是当我尝试上传 600MB 视频时,应用程序崩溃了 - 程序收到信号“0”错误。
我想知道,使用 FBConnect 库从 iOS 应用程序上传视频是否有视频大小限制?
FBVideoUpload.m 类以下方法的 Follwing 方法存在问题 通过URL开始上传 // 应用程序因 NSData 对象而崩溃。因为 NSData 试图将 600MB 视频文件数据保存在单个对象中。// 参数 setObject:[NSData dataWithContentsOfURL:movieURL] forKey:[movieURL LastPathComponent]]; // 应用程序在这一行崩溃
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" error.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Facebook 的 REST API 视频上传文档说道:
它可能与您使用的 API 不同,但我想原理是相同的。
Facebook's REST API video upload documentation says:
It's probably not the same API you're using, but I imagine the principle is the same.
我认为您可能需要考虑在将 600MB 视频发送到 Facebook 之前对其进行编码,或者至少对其进行大量压缩并将其推送到您的一台服务器以进行远程发布。下载完成之前,iPhone 可能会耗尽电量。
或者,您可以将捕获的视频分成多个片段并单独上传。
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.
您的应用程序崩溃的确切原因是您试图将更多的 MB 放入内存而不是可用的内存。 iOS 的反应是关闭您的应用程序。如果你确实需要能够处理这么大的文件,你必须找到一种一点点处理它的方法。
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: