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
Related
I am having a problem getting Facebook events in the Facebook app. For example, to open an event with the url "https://www.facebook.com/events/1743847059178738/," I would use the following code:
let facebookURL = NSURL(string: "fb://event/1743847059178738")!
if UIApplication.sharedApplication().canOpenURL(facebookURL) {
UIApplication.sharedApplication().openURL(facebookURL)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
}
}
It will open the Facebook app, but no matter what event I attempt to display I get a screen saying "Unable to load event. It may have been cancelled." I have tried substituting the Facebook URL of an event for that of a profile (e.g., string: "fb://profile/100005906912309") and it works just fine. Am I mistaken in assuming that the numbers at the end of the event's URL are the same as the event's numeric ID?
So I figured out that I could bypass the whole "fb://event..." bit and just go with:
UIApplication.sharedApplication().openURL(NSURL(string: "https://www.facebook.com/events/1743847059178738")!)
I assumed this would open the link in Safari, but it automatically opened in Facebook in iOS 8.
I'm sorry for the late answer. I'd prefer to write this as comment, but I'm not able to.
First, nice work around. I think it is a perfect fallback if the fb:// scheme fails as it shown in code shared with your question. I've spent a lot of time trying to resolve the same issue. What I've found is that fb://event/{event-id} is no longer supported and it was replaced with fb://event?id={event-id}.
I've used this post as a reference.
So, I am trying to implement the facebook open graph posts in our game for highscores, but it doesn't seem to post anything. When I do this:
Dictionary<string, string> data = new Dictionary<string,string>() { {"highscore", "http://samples.ogp.me/111111111111111"}};
FB.API("me/namespace:get_a_new", Facebook.HttpMethod.POST, HandleOpenGraphCallback, data);
When I log the FBResult.text in the HandleOpenGraphCallback callback, I get a valid json response looking like this: {"id":"422166374597399"}. But the problem is that I see nothing on the test account that sent that request. The request obviously kind of worked since I receive an id in my callback function, but I see no post. Do I need to put more information in my dictionary in order to even see the post in the my test account timeline? I also put the "publish_action" permission in my login to be sure.
Thank you.
How can I get Friends/Friend's IDs of my twitter account using Twitter API?
In this tutorial https://github.com/bengottlieb/Twitter-OAuth-iPhone and example of, I can just send the updates or send any direct messages, but I can't get any direct messages or Friend's IDs or any other things that can be found from the get methods.
How can I find any data that was parsed from the get methods? (Example: getPublicTimeline, getUpdate:(unsigned long)updateID, getDirectMessagesSinceID:, etc..)
Can anyone suggest how to solve this problem?
https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=screennameofUser
yes.You have getFriends method.Also You have getFollowersIncludingCurrentStatus method.These methods will return to the following Callback,
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier
{
//Here You can parse userInfo and get the list
}
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'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.