iPhone - A problem with uploading video to facebook - iphone

I am having a problem uploading a video to facebook.
Last month, it worked OK.
I can still log in to FaceBook with my appKey and appSecretKey, but if I request 'facebook.video.upload' method to facebook, the site does not reply.
In the past, it worked perfectly.
What is the problem? Has FaceBook updated the interface?
Thanks!

For me I use FBVideoUpload (source code here) and it works fine, so I put my code here:
m_Facebook = [[Facebook alloc] init];
m_FacebookUploader = [[FBVideoUpload alloc]init];
NSArray *permissions = [NSArray arrayWithObjects:#"publish_stream", #"offline_access",nil];
m_Facebook.forceOldStyleAuth = YES;
[m_Facebook authorize:APP_ID permissions:permissions delegate:self];
In Facebook delegate methods
- (void)fbDidLogin
{
NSURL *movieURL = [NSURL fileURLWithPath:m_MoviePath];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
#"Look at my funny video !", #"title",
#"A message", #"description",
nil];
[m_FacebookUploader setApiKey:APP_ID];
[m_FacebookUploader setAccessToken:m_Facebook.accessToken];
[m_FacebookUploader setAppSecret:APP_SECRET];
[m_FacebookUploader startUploadWithURL:movieURL params:params delegate:self];
}

Related

Facebook integration showing alert address is invalid

I am new in iPhone application development. Now i am developing application for iPhone In this application I need to upload video to Facebook. i am used below code. Now enter Facebook the user name and password. showing error message alert. like safari cannot open the page because the address is invalid.
- (void)viewDidLoad
{
facebook = [[Facebook alloc] initWithAppId:#"Facebook_App_Id"];
//#"com.facebook.samples.VideoUploadTest"];
facebook.sessionDelegate = self;
}
- (IBAction)buttonClicked:(id)sender {
NSArray* permissions = [[NSArray alloc] initWithObjects:
#"publish_stream", nil];
[facebook authorize:permissions delegate:self];
[permissions release];
}
- (void)fbDidLogin {
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"sample" ofType:#"mov"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, #"video.mov",
#"video/quicktime", #"contentType",
#"Video Test Title", #"title",
#"Video Test Description", #"description",
nil];
[facebook requestWithGraphPath:#"me/videos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
referred from this url [http://developers.facebook.com/blog/post/532/]
Refer this for SSO settings.
http://developers.facebook.com/docs/mobile/ios/build/

Image change in dialogFeed facebook

How can I add my own picture for the feed. I have it in my application folder. I have to give my image instead of #"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png".
- (void)apiDialogFeedUser {
currentAPICall = kDialogFeedUser;
SBJSON *jsonWriter = [[SBJSON new] autorelease];
// The action links to be shown with the post in the feed
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"Get Started",#"name",#"http://m.facebook.com/apps/hackbookios/",#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
// Dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"I'm using the Hackbook for iOS app", #"name",
#"Hackbook for iOS.", #"caption",
#"Check out Hackbook for iOS to learn how you can make your iOS apps social using Facebook Platform.", #"description",
#"http://m.facebook.com/apps/hackbookios/", #"link",
#"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", #"picture",
actionLinksStr, #"actions",
nil];
HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"feed"
andParams:params
andDelegate:self];
}
I want to have my image over there. Please help.
The 'picture' parameter only accepts urls of already hosted pictures.
If you want to use a picture which is stored locally then you'll need to upload it first to a server and then use that url when posting to the feed.

iPhone SDK FBConnect webcore decodeGIFFrame exec_bad_access

- (void)apiDialogFeedUser {
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:#"test",#"name",#"http://test.co.in",#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"test", #"name",
#"test", #"caption",
#"test", #"description",
#"http://test.co.in", #"link",
#"http://test.co.in/images/b_freequote.jpg", #"picture",
actionLinksStr, #"actions",
nil];
Demo1AppDelegate *delegate = (Demo1AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] dialog:#"feed"
andParams:params andDelegate:self];
}
I am using the code above to post to Facebook wall. But after when the dialog opens its suddenly throwing exec_bad_access. Its pointing to decodeGIFFrame. I have no idea what it is. Can anybody suggest what the problem is? Hope everybody understood my question.
Thanks in advance.
UPDATE:
I found the problem is with Facebook AppId. When I tried it with Hackbook id this problem disappeared. But I don't know what settings in my AppId is causing this problem. Any idea?
I am answering my own question. When I changed the default logo of my application through developer.facebook.com its solved my issue. Its really worked! Hope this will help somebody.

How to cancel a video upload in progress using the Facebook iOS SDK?

I'm using the Facebook iOS SDK to post videos from my app to the user's facebook.
I'm trying to allow the user to cancel the upload after the upload has started.
These are the methods that starts the upload:
- (void)startUpload
{
NSArray* permissions = [[NSArray alloc] initWithObjects:
#"publish_stream", nil];
[facebook authorize:permissions];
[permissions release];
}
- (void)fbDidLogin
{
NSString *filePath = [videoNSURL path];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, #"video.mov",
#"video/quicktime", #"contentType",
videoTitle, #"title",
videoDescription, #"description",
nil];
[facebook requestWithGraphPath:#"me/videos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
I cannot find any methods inside Facebook.h that comes with the Facebook iOS SDK that allows me to cancel the upload.
Even if I do a [facebook release], it will still not cancel the FBSession which is trying to upload the video. Which means I'll get a exc_bad_access when the upload is complete when FBSession tries to inform the facebook object that the upload is complete.
I added the following methods:
FBRequest
(void) cancel {
[_connection cancel];
[_connection release], _connection = nil;
}
Facebook
(void)cancelPendingRequest {
[_request cancel];
[_request release], _request = nil;
}
cancelPendingRequest will allow me to cancel a video upload in progress.

How to post to facebook from iPhone using publish.stream without the Facebook dialog method

I would simply like to use publish.stream to post to Facebook from an iPhone app but without using the UIWebview that pops up when you call the Facebook object's dialog method. How do I do this?
SBJSON *jsonWriter = [[SBJSON alloc] init]; NSDictionary *attchmentDic = [NSDictionary dictionaryWithObjectsAndKeys:
#"Foobar",#"name",
nil]; NSString *attachmentStr = [jsonWriter stringWithObject:attchmentDic]; NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Bla-bla",#"message",
attachmentStr, #"attachment",
nil];
[_facebook requestWithMethodName:#"stream.publish"
andParams:params
andHttpMethod:#"POST"
andDelegate:self]; [jsonWriter release];