I'm uploading photos to Facebook from my iPhone application. I've got it working, except that sometimes, it returns "Unknown Error Occurred". I'm not sure what the problem is. This happens about 75% of the time.
Has anyone else encountered this?
Still not sure what was happening, but I solved the problem. Here's what I did:
- (void)request:(FBRequest*)request didFailWithError:(NSError*)error {
if ([error code] == 1 && [[request method] isEqualToString:#"photos.upload"]) {
FBRequest *tryAgain = [FBRequest requestWithDelegate:self];
[tryAgain call:[request method] params:[request params] dataParam:(NSData *)[request dataParam]];
}
}
Essentially, I just made it try again. Resending the same request didn't work (failed with an invalid signature), so I created a new request with the properties of the old one.
The nice thing about this is that it is sort of recursive: if the new request fails too, it will just keep trying. I hope I don't encounter any negative side-effects of that, though.
Try it on the simulator and use an http debugger like Charles to see what is happening during the transfer and what the response is from Facebook.
Related
Here i am trying to add a post to facebook using following code.
FBAppCall *appCall = [FBDialogs presentShareDialogWithLink:urlToShare
name:#"Title"
caption:nil
description:#"description"
picture:nil
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if (error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
But this isn't working. It give following error.
Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x1cde3340 {error_code=102, action_id=E780C3AA-1387-4B9C-9A3A-9A16FB54BC59, error_message=An error occurred during publishing., app_id=558567750859724}
Here i am working on cocos2d, is this can be the reason.
Go to your app's settings under the Facebook developer portal.
Go to open graph > types
Choose the action type using and turn on "User Generated Images" for that action type. Save these settings and try again. It will work.
I encountered this error as well, make sure you disable the sandbox mode in Facebook admin panel before distributing to any other user :P
I recently encountered this error when the link I tried to post did not load correctly (was loading a 404 page). Not sure why, but maybe Facebook requires the link work.. Either way they need to make their error messaging more specific.
I originally used FBLoginView to start the login process in the latest Facebook SDK (3.5). However, that would crash the app because of a loop of some sort. I then read that I should try logging in using the code below as a test:
[FBSession openActiveSessionWithReadPermissions:[NSArray arrayWithObjects:#"read_stream", nil] allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// session might now be open.
NSLog(#"Error - %#", error);
}];
I got exactly the same issue. A huge number of processes (with the same name) get called and the app crashes. Does anyone know why this would happen when using the Facebook SDK? Here is an image of the thread that crashes:
As you can see there's something not right here. Anyone got any ideas?
Regards,
Mike
This was a bug and is now fixed.
Edited --
This has been fixed on both client and server as of the Facebook SDK 3.5.1 for iOS. Here is the link:
https://developers.facebook.com/resources/facebook-ios-sdk-3.5.1.pkg
--
Thanks for notifying us of this problem!
I had the same issue, and tried setting sandboxing (in fb app dashboard) to false, and then it worked...
I'm having what seems to be the exact same problem, and nearly the same stacktrace,but I already have sandboxing disable, in fact, my app has been in production for 9 months, but we were using still sdk 2.0 and just gotten around to upgrade it.
I have narrowed It down a lot. Here I give a good explanation about my problem, and a temporary solution that fixes my problem, but It's viable for production..
Facebook SDK FBLoginView getting EXC_BAD_ACCESS
When I run same code in simulator I get success Response for image post:
{
id = 248572435289479;
"post_id" = "244759709004085_248572441956145";
}
When I run in same code in device I get:
Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x208a8dd0 {error={
code = 1;
message = "(#1) An unknown error occurred";
type = OAuthException;
}}
"
OAuthException means that there was an authentication issue. Be sure that the following are true on your device.
You are logged into a facebook account successfully
If you are, then remove the app from the phone
Do a clean and re-deploy to the phone
If none of the above work, try logging out in Settings on the phone and logging back in. Then try logging in through safari. Sometimes the iOS facebook authentication can be a little buggy. Also try a different app that is guaranteed to work with iOS facebook accounts. Something like, Hootsuite.
If there is still an issue after all that... I am not sure what you tell you.
This link might help you.
and #giff's answer also explains it to some extent on this link.
log of your issue in this might help you to get further detail of your error.
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
NSLog(#"%#", [error localizedDescription]);
NSLog(#"Err details: %#", [error description]);
};
I recommend you to try this if none of the solutions given above could help you.
Remove the application from the list of authorized applications and authorize it again with the needed permissions.
Hope this works for you
I'm trying to add a method to MGTwitterEngine to use twitter's retweeted_by API ( http://dev.twitter.com/doc/get/statuses/:id/retweeted_by ).
Here is what I've added to MGTwitterEngine.m (all the OAuth stuff is done, the other methods inside the engine work fine)
-(NSString *)getUsersWhoRetweetedTweetWithID:(unsigned long)ID {
NSString *path = [NSString stringWithFormat:#"statuses/70482402362933249/retweeted_by.xml"];
return [self _sendRequestWithMethod:nil path:path queryParameters:nil body:nil
requestType:MGTwitterUsers
responseType:MGTwitterUsers];
}
Note: I've already included the .xml format and a status ID - just to ensure there's nothing wrong with the data I'm passing on. When I call [_engine getUsersWhoRetweetedTweetWithID:0]; from my app controller, error 404 is returned "The operation couldn't be completed. (HTTP error 404.)".
I've tried it with a parameters NSDictionary & tried changing the request & response types.
Currently, I don't make use of MGTwitterEngine to check who RTd a tweet, I just use a non OAuth'd method - however this will not return protected users who RTd a tweet.
Can anyone give me a point in the right direction - it's being driving me crazy for the past few days! I really appreciate any input :)
Take a look here.....
How to do a RETWEET on an iPhone twitter app (MGTwitterEngine)
MGTwitterEngine does not support re-tweet method yet .. you have to manually add the parse to MGTwitterEngine .h and .m then the call out would be [_engine sendRetweet:(unsigned Long)];
Now I am in the process of trying to determine how you call out the unsigned long...if any one else has an answer to that I would be happy to hear it myself.
I am using stream.publish to publish some info to a users wall. This all works fine.
I am not using FBStreamDialog because i do not want the user to be able to edit the message..... So i have set up my own UI.
It all works fine and the stream is published to the users wall, the only issue is that i do not understand the result obtained from the delegate method:
- (void)request:(FBRequest*)request didLoad:(id)result {
NSLog(#"result = %#", result);
}
I need to understand what the result is telling me so that i can handle any errors. Currently the following is being printed in the console but i do not know what this means:
result =
100000874992250_117813161591916
Any help or advice regarding this issue would be highly appreciated.
Thanks
Tom
Ok stupid question... i have found in the documentation that the response is:
"This call returns a post_id string
containing the ID of the stream item
upon success. If the call fails, it
returns an error code instead."
My question now is... how would i handle the response, so that i know there is not an error.
I cant check against all error codes because there are a lot of them!
Thanks
Tom