I want to upload video on facebook using ios-sdk
I check discussion in question iPhone Facebook Video Upload and try to implement it in my application
I try to your code but not succeed
- I download your code https://github.com/zoul/facebook-ios-sdk
- take the FBVideoUpload.h/m classes from your src add add into my project
include "FBVideoUpload.h" in FBConnect.h
- then I code for upload video as follow
This is Code
FBVideoUpload *upload = [[FBVideoUpload alloc] init];
upload.accessToken = facebookObj.accessToken;
upload.apiKey = fbAppKey;
upload.appSecret = fbAppSecret;
NSString *filePath = @"/Users/pratgupta/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE/IMG_0010.M4V";
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];
But got the error in Logs i.e
Unable to retrieve session key from the access token.
which is due to
if ([self sessionID] == nil) {
NSLog(@"Unable to retrieve session key from the access token);
return;
}
in class FBVideoUpload
For Login I am using this code
fbPermissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access", @"publish_stream",nil] retain];
facebookObj = [[Facebook alloc] initWithAppId:fbAppId];
[facebookObj authorize:fbPermissions delegate:self];
I am able to fetch my updates from facebook so then session is ok here.
Can you please tell me What wrong I am doing?
EDIT
After changing the login steps suggested by the zoul I am now not getting the sessionID error log.. My request is now sending to the fb server but getting this response
<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<error_code>100</error_code>
<error_msg>privacy must contains a valid privacy 'value'</error_msg>
<request_args list="true">
<arg>
<key>description</key>
<value>upload testing</value>
</arg>
<arg>
<key>privacy</key>
<value>EVERYONE</value>
</arg>
<arg>
<key>v</key>
<value>1.0</value>
</arg>
<arg>
<key>api_key</key>
<value>[here is my API key]</value>
</arg>
<arg>
<key>method</key>
<value>facebook.video.upload</value>
</arg>
<arg>
<key>session_key</key>
<value>c4ada192feb82e8f239a283d-555042146</value>
</arg>
<arg>
<key>sig</key>
<value>8255d4cc3838b278b26fbfc8c86818a3</value>
</arg>
<arg>
<key>title</key>
<value>test</value>
</arg>
</request_args>
</error_response>
Amit Battan
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…