I'm using sinch and I've gotten the client to work by registering a user, but I can't send a message. When I click my send button, nothing happens. The required methods that need to be implemented, such as messageFailed(), messageDelivered(), etc. are not being called either. Does anyone know why?
Have you registered the one more user? Can you enable logging and share the full log output.
See comment below, user tried to send message to self
I'm sending a Facebook app-invite from my iOS app, and am trying to implement a success/fail flow using blocks.
I have created a class to wrap my communication with the Facebook SDK which exposes a send invite method.
In that method, I have the following code:
[self.facebook dialog:#"apprequests"
andParams:params
andDelegate:self];
as explained in the documentation.
My wrapper class conforms to the FBDialogDelegate protocol, and I have implemented 5 of the delegate methods:
dialog:(FBDialog *)dialog didFailWithError:(NSError *)error,
dialogCompleteWithUrl:(NSURL *)url,
dialogDidComplete:(FBDialog *)dialog,
dialogDidNotCompleteWithUrl:(NSURL *)url
dialogDidNotComplete:(FBDialog *)dialog
The problem is that wether the user cancels the dialog or sends the request, the only method that is being called is the dialogCompleteWithUrl:(NSURL *)url method.
Can anyone explain this?
This seems to be an outstanding issue that has been reported several times. The fact that didComplete is called when the user presses the cancel button is indeed a valid action so it is by design that didComplete gets called. The documentation might be outdated and we have a task to fix it, but reporting a doc bug on our developer site will allow you to track the progress.
So to answer your question, if the user presses the 'x' button it should call didNotComplete. User pressing send or cancel will call didComplete as it is designed that way.
However, this person came up with a good workaround for FBDialog where you can probably do something similar, such as checking the value of the URL when it succeeded vs when the user presses cancel and have an if check that checks for that case.
Hope this helps.
I am running the Facebook SDK 3.1 on Xcode 4.5GM with iOS6 simulator. I connect to FB in the iOS settings and successfully FB connect in my app using the new iOS6 FBConnect UI. I have an access token, can see my friends, send app requests, post to my wall, etc. However, every time I initiate any sort of FBURLConnection is made, I see this printed to my console:
Error: HTTP status code: 400
I went into the FB code and printed the reponse when this error is printed and I get:
{
body = {
error = {
code = 100;
message = "(#100) The parameter 'attribution' is required for the 'mobile_app_install' activity";
type = OAuthException;
};
};
code = 400;
}
Does anyone know how to resolve this? All functionality seems to work, but I keep seeing this spam my console.
Right after the session is created do this:
[FBSession setActiveSession:session];
As best as I can tell, this is a bug introduced in the 3.1 SDK. Looking at the network traffic with Charles, they’re trying to POST to graph.facebook.com/[user id]/activities but it’s failing.
After much troubleshooting and looking at all the suggestions on Stackoverflow, I got this error 400 (error.code = 5) thing resolved.
The solution in my case was to make sure the params (aka postParams) included in my startWithGraphPath call had exactly the params supported by the type of content being posted.
More specifically, I was posting a link to me/feed with the #"ref" key (typically used for tracking with FB Insights).
After removing the #"ref" key, startWithGraphPath succeeded.
NSMutableDictionary *postParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Test NAME field (from ios app)", #"name",
#"Test caption", #"caption",
#"Test description", #"description",
#"http://example.com/test1.html", #"link",
#"http://example.com/water.jpg", #"picture",
// #"foo", #"ref", // WRONG!
nil];
[FBRequestConnection startWithGraphPath:#"me/feed"
parameters:postParams
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
My activeSession (and all other possible culprits) checked-out OK.
This is the same as my answer from here: Facebook SDK 3.1 - Error: HTTP status code: 400
But it could help people still getting the 400 error.
The original issue was resolved by Facebook just after the 3.1 SDK was released.
But some are still having issues, if you have this issue you should check the login flow, and look at facebooks examples, if you are still having issues this could be a hint to a solution.
I got the 400 error when I do not have authorization to get to my information. The strange thing is that I get an accessToken and even a valid login (this is because I structured my code, with the help according to Scrumptious example and I did a valid login when the Session state is open).
The FBSessionState is only opened for like a second and then it changes to closed with an 400 Error.
With iOS6 native login you get the permission alert when you ask for it, and then the phone remember that choice for 24 hours. But if the user logs in to the facebook home-page and then deletes permission for the application the phone will remember that setting for 24 hours, regardless if you re-install the app or not.
This I found out after some hours of debugging, since I allowed the application from the Settings in iOS, but I could not post, and since I deleted the permission from the facebook privacy, and the alert would not show again there was nothing I could do but to manually give me permissions via a debug tool or wait 24 hours so I could accept the facebook-permission alert again.
I discovered that Status Code 400 is also thrown with FBErrorHTTPError when something go wrong with Optional Properties in Define Action Type fieldset, within the Facebook=>Open Graph definition panel.
In my case I was posting an action object without a property marked as isRequired. Be also aware for isArray option and in general, for right matching with what you're sending.
This error reflected a bug on the server, which was fixed shortly after the 3.1 release was published. At this point there should be no more failures coming from this request. Hope this helps!
My fbDidLogin delegate method didn't called at first time. I searched and found "fbDidLogin not called" and "IOS - Facebook SDK fbDidLogin not called — initialize view controllers" and handled the facebook url into my Application Delegate correctly. But fbDidLogin method didn't called. So I searched again. Someone says in "Problems with fbDidLogin never called iOS" to change
[self authorizeWithFBAppAuth:YES safariAuth:YES];
into
[self authorizeWithFBAppAuth:NO safariAuth:YES];
in my Facebook.m file. After doing that my facebook login view just changed, yet couldn't get what I need. In that situation what I did? I added a line
[facebook logout:self];
right after
[facebook authorize:permissions];
Because I thought there is a problem in login or/and logout syncronisation, so if I call facebook logout method it might (yes, MIGHT) work.Voila! it does work, at least for me.Now all I want to ask you, is there any problem or logical error in my process? And is there a better way to do so?
I've successfully set up the "DemoApp" project from the Facebook IOS SDK to use my "OKC ThunderCast" Facebook application. I have also configured another "Tester" application from scratch to successfully use the Facebook SDK and publish stories to my news feed. However, in my production application, I always get this result when calling the "dialog" method. The full description of the error message is "Error on line 52 at column 17: Opening and ending tag mismatch: div line 0 and body"
Here's a detailed walkthrough of all of my code to make sure nothing is missed.
1) A UIViewController calls the "authorize" method
NSArray *fbPerms = [NSArray arrayWithObjects:#"read_stream", #"offline_access", nil];
[[FacebookSingleton sharedInstance].facebook authorize:fbPerms delegate:self];
Note: The FacebookSingleton is a class I wrote that always returns a single instance of the "Facebook" class. I am using it successfully in other applications.
2) Safari is opened and the user is successfully authenticated and authorized
3) The application is called back and the "handleOpenUrl" method is called, which calls the "fbDidLogin" method of the UIViewController
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
Facebook *fb = [FacebookSingleton sharedInstance].facebook;
return [fb handleOpenURL:url];
}
4) The same UIViewController handles the "fbDidLogin" event, and calls the "dialog" method
- (void)fbDidLogin
{
[[FacebookSingleton sharedInstance].facebook dialog:#"feed" andDelegate:self];
}
I also have the necessary "URL Schemes" and "URL Types" entries in the .plist file. To my eyes, I am using exactly the same code in the "DemoApp", "Tester", and production applications. But while the DemoApp and Tester work, I always see this HTML error in the feed dialog in my production application. Has anyone seen a similar issue? Could it be related to the Facebook "Bundle ID" setting in the Facebook application settings? Is there some build or .plist setting that is different?
I have invested a great deal of time into troubleshooting with no success in several weeks. Thanks in advance...
The cause of the problem was setting a value to the key "User-Agent" in the NSUserDefaults dictionary. I wanted to specify my own User-Agent to uniquely identify my iOS app. But somehow setting this value caused the problem above. When I simply renamed this key to "OKCTC-User-Agent" the error was immediately resolved.
I did log an issue on the GitHub site for the Facebook-IOS-SDK. Hopefully this will help others who have encountered similar problems.