title: iPhone Facebook Video Upload
body: <p>I've been working on this for a couple of days now and just can't seem to find a straight answer or example anywhere. I am trying to upload a video to facebook from within my iPhone App. I can connect to facebook (and have uploaded pictures) without a problem using:</p>
  
  <pre><code>_facebook = [[Facebook alloc] initWithAppId:kAppID];
  _permissions =  [[NSArray arrayWithObjects:@"publish_stream", @"offline_access",nil] retain];
  [_facebook authorize:_permissions delegate:self];
  </code></pre>
  
  <p>However I can't seem to get my video uploading working. My current code is:</p>
  
  <pre><code>NSString *filePath = [[NSBundle mainBundle] pathForResource:@"TestMovie" ofType:@"mp4"];
  NSData *data = [NSData dataWithContentsOfFile:filePath];
  
  NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 data, @"video",
                                 nil, @"callback",
                                 @"test", @"title",
                                 @"upload testing", @"description",
                                 @"EVERYONE", @"privacy",
                                 nil];
  
  [_facebook requestWithMethodName:@"video.upload"
                         andParams:params
                     andHttpMethod:@"POST"
                       andDelegate:self];
  </code></pre>
  
  <p>And since video upload calls have to be made to a different server I changed the restserver url within the facebook.m file to:</p>
  
  <pre><code>static NSString* kRestserverBaseURL = @"https://api-video.facebook.com/method/";
  </code></pre>
  
  <p>When I run this the upload crashes with an error:</p>
  
  <pre><code>facebookErrDomain err 353.
  </code></pre>
  
  <p>Any help would be appreciated. </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>With Zoul's help I now have the following code implemented (I have done nothing to alter his upload class nor the version of the SDK it came with). The request no longer gets an error however nothing is being uploaded. </p>
  
  <p>I initialize the facebook object and the upload object: </p>
  
  <pre><code>_facebook = [[Facebook alloc] initWithAppId:kAppID];
  _permissions =  [NSArray arrayWithObjects:@"publish_stream", @"offline_access",nil];
  [_facebook authorize:_permissions delegate:self];
  _upload = [[FBVideoUpload alloc] init];  
  </code></pre>
  
  <p>And then I use it once facebook has logged in:</p>
  
  <pre><code>- (void)fbDidLogin{
      _upload.accessToken = _facebook.accessToken;
      _upload.apiKey = kApiKey;
      _upload.appSecret = kApiSecret;
  
      NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"mp4"];
      NSURL *fileURL = [NSURL fileURLWithPath:filePath];
      NSData *data = [NSData dataWithContentsOfFile:filePath];
  
      NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                 data, @"",
                                 @"test", @"title",
                                 @"upload testing", @"description",
                                 @"EVERYONE", @"privacy",
                                 nil];
  
      [_upload startUploadWithURL:fileURL params:params delegate:self];
  }
  </code></pre>