facebook / facebook-ios-sdk Goto Github PK
View Code? Open in Web Editor NEWUsed to integrate the Facebook Platform with your iOS & tvOS apps.
Home Page: https://developers.facebook.com/docs/ios
License: Other
Used to integrate the Facebook Platform with your iOS & tvOS apps.
Home Page: https://developers.facebook.com/docs/ios
License: Other
When publishing a stream with a long description field (text needs to be past the Skip/Publish buttons), the text extends past the end of the screen and goes behind the Skip/Publish buttons.
When you scroll the view the skip/publish buttons move up and are over the top of the description text instead of being at the bottom of the screen.
Trying to upload a photo, this code:
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[facebook requestWithMethodName: @"photos.upload"
andParams: params
andHttpMethod: @"POST"
andDelegate: self];
results in:
"The operation couldn’t be completed. (facebookErrDomain error 1.)"
This code:
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"source",
name,@"message",
nil];
NSString* album = albumid;
album = [album stringByAppendingString:@"/photos"];
[facebook requestWithGraphPath:album andParams:params andHttpMethod:@"POST" andDelegate:self];
results in:
The operation couldn’t be completed. (facebookErrDomain error 10000)
I had this working with the old rest api, but in the new graph api it does not look like working.
Please check if you could add the following code to FBDialog.m to avoid the warning
#if __IPHONE_OS_VERSION_MIN_REQUIRED <= __IPHONE_2_2
_closeButton.font = [UIFont boldSystemFontOfSize:12];
#endif
Kind Regards
Graham
Can you help me? I can't understand how to send message (not stream publish with target_id, private message) to some user with API methods and how mark some thread messages "read".
Been testing a few things with this new SDK the last days, and there are several parts of the Graph API that doesn't seem to work. As an example doing:
[facebook requestWithGraphPath:@"app_id/likes"
andDelegate:self];
Just returns an empty dictionary from the server. Replacing app_id with the actual numeric id of the app. Also doing "album_id/photos" returns an empty dictionary.
Am I misunderstanding something, or is there something wrong with this library?
This may be a dumb question:
If all that is required for me to authenticate a session with facebook from inside my app is my app id, what prevents someone else from using MY app id in their app? My app id is publicly visible in my app's facebook url (facebook.com/apps/application.php?id=xxx). There used to be a secret or api key required to create a session - or am I missing something?
Because upload video is not yet supported with graph's i was bouncing it off the REST API, as it turns out I ran into the issue that "This method must run on api-video.facebook.com", most likely I assume the new SDK doesnt know or detect which one to use and always uses api.facebook.com. Is there an easy solution to this? Or am i possibly doing something wrong?
[defaults removeObjectForKey:@"FBSessionKey"]; should be:
[defaults removeObjectForKey:@"FBAccessToken"];
Hi!
I've noticed that when a user enters his username and password, and hits the "Login" button, there's no indication as to whether or not the login is performing.
I mean, no activity indicator is showed while the login is occurring. Will it be possible to add one? How could I add a spinner at the precise moment after which the user has hit the "login" button?
I think it's really important to have one there, otherwise it seems like the app is unresponsive, or that the login button for some reason didn't get pressed...
Thanks!
I'm uploading photo's along with the publish_stream permission. Photo uploads are working fine, and go to the correct place, however, it is not always posted in the users stream. Sometimes it does, sometimes it does not (on the same facebook user account). I can't seem to find a reason why, any help / suggestions would be appreciated. I will say that using the prior sdk, the photo's would upload and would show in the users stream every time. So, I'm not sure if the problem is with the SDK, my code, etc.
Authorizing & Permissions
NSArray *permissions = [[NSArray arrayWithObjects: @"read_stream", @"offline_access", @"publish_stream", nil] retain];
[_facebook authorize:kAppId permissions:permissions delegate:self];
Posting Picture
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
uploadPicture, @"picture", picCaption, @"caption", nil];
[_facebook requestWithMethodName: @"photos.upload"
andParams: params
andHttpMethod: @"POST"
andDelegate: self];
I just realized there is no way to cancel a request. As of now I can't dealloc some of my views as long as there is a request that I haven't gotten an answer for. Can you add a cancel method?
Hi there, and thanks for releasing the library on github.
I don't seem able to send a pull request to the github user "facebook." I've sent a couple to the user "yujuan"--is this the appropriate way to do it?
Basically, what I wanted to do was to upload a UIImage and then publish that particular photo to the stream via a FBDialog. The only way I've been able to upload a photo via NSData is to call requestWithMethodAndName:
[_facebook requestWithMethodName: @"photos.upload"
andParams: imgParams
andHttpMethod: @"POST"
andDelegate: self];
From there, the FBRequestDelegate returns an object that gives a link to the album photo. It also generates a thumbnail link to the photo via a FBCDN domain. Afterwards, my plan was to use to generate a UI dialog which calls stream.publish with a media attachment (basically the information that FBRequestDelegate returned):
[_facebook dialog: @"stream.publish"
andParams: params
andDelegate: self];
However, since Facebook does not allow images hosted on their domains (e.g. FBCDN) to be published with streams, I can't actually show the proper image. The reason I opted to use stream.publish was to let the user create a personalized message to be published into their wall. However, since I can't use the FBCDN link, I haven't figured out a way to actually show the image aside from hosting the image off-site which, in my mind, isn't exactly as efficient.
Is there an easier way to approach this issue? Thanks in advance.
Having some problems uploading photos to groups here. Works fine when I try to upload to the users own album, but using the oid of the group, and trying to upload will just allow the upload to finish, and then return an empty result with no error.
Anybody know what might be causing this?
I wish to delete an album, so I use this code ..
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObject:@"delete" forKey:@"method"];
[appDelegate.facebook requestWithGraphPath:[cellDict objectForKey:@"aid"] andParams:params andHttpMethod:@"POST" andDelegate:nil];
Here's the request/response flow ...
2010-08-27 22:17:02.575 ShareOrStare[19975:207] request: <NSMutableURLRequest https://graph.facebook.com/100000364547939_20156?method=delete&sdk=ios&access_token=1xxx&format=json>
2010-08-27 22:17:03.552 ShareOrStare[19975:207] response: {"error":{"type":"Exception","message":"(#100) Invalid parameter"}}
The album exists and the ID is correct. What is the issue here?
So I've been using this framework to login my user, and then loading UIWebViews to display some of the standard Facebook pages like http://www.facebook.com/home.php?sk=h
This morning this suddenly only works the first time I start the app up. The second time I start up the app the normal webpages redirect me to login.php like if my cookies weren't valid. I even went back to my 1.0.0 release here and I get the exact same behavior there. Now if I clear all my cookies it works perfectly again until I load up the app the second time. Since nothing has changed at my end I have to assume the change is at Facebook's end?
This is my login procedure:
(void)socialize
{
if(!facebook)
facebook = [[Facebook alloc] init];
if(![facebook isSessionValid])
{
socializing = YES;
[self login];
}
}
(void)login
{
NSArray *permissions = [NSArray arrayWithObjects:@"publish_stream", @"create_event", @"rsvp_event", @"manage_pages", @"user_about_me", @"", @"user_activities", @"user_birthday", @"user_education_history", @"user_events", @"user_groups", @"user_hometown", @"user_interests", @"user_likes", @"user_location", @"user_notes", @"user_online_presence", @"user_photo_video_tags", @"user_photos", @"user_relationships", @"user_religion_politics", @"user_status", @"user_videos", @"user_website", @"user_work_history", @"", @"read_stream", @"offline_access", @"friends_about_me", @"friends_activities", @"friends_birthday", @"friends_education_history", @"friends_events", @"friends_groups", @"friends_hometown", @"friends_interests", @"friends_likes", @"friends_location", @"friends_notes", @"friends_online_presence", @"friends_photo_video_tags", @"friends_photos", @"friends_relationships", @"friends_religion_politics", @"friends_status", @"friends_videos", @"friends_website", @"friends_work_history", nil];
[facebook authorize:appId
permissions:permissions
delegate:self];
}
Doing normal Graph API calls with the framework works fine, it's just loading the normal webpages that seem to be the problem. So what changed last night?
Am I missing something? When using publishStream I want to include the URL to a specific product that includes a query string as the href for the post to link to, set in the "attachment" NSDictionary with the key "href" in the - (IBAction) publishStream: (id)sender method. It works fine if I use a URL with no query string, but if there is an ampersand in the url it doesn't send any of the data (name, caption, description, or url) to the Facebook post.
The same URL worked fine with the previous version of the Facebook iPhone sdk, and no way of escaping the & seems to work.
When attempting to login to FB - the first view gives:
{"error":{"type":"OAuthException","message":"Missing redirect_uri parameter."}} in the web view. This is prior to providing login credentials.
When a user is logged in but the access token is expired, calling -(void)authorize:permissions:delegate: on the Facebook object causes the FBLoginDialog box to animated on and off the screen instantly. If the renewal can be done without user interaction, it would be a much better experience to let that happen in the background instead of obstructing the application.
When you allocate the NSURLConnection in FBRequest.connect (line 271) - you do the following:
_connection = [[[NSURLConnection alloc] initWithRequest:request delegate:self] retain];
But if you call "alloc" you do not need an extra "retain".
I removed that "retain" and it still works.
How i can add photo to some album with specific aid?
In the description of the api method (photos.upload) says that specifying the identifier, I can download the photo into the appropriate album. But, really, photos uploaded to default application album. Tell me, please, what my mistake?)))
ps: sorry for my english, i know it's terrible))
when I perform the git clone in macosx, error "the remote end hung up unexpectedly" is reported. Then I tried the git clone http://....... it asks me for a username and password... and I cannot go through that.. Authentication failed.
So, what should I do??
i'm trying to use the facebook-ios-sdk and see that there are no tags specified for a "last known good" or stable release. The benefit of doing this is many..
So.. please add some tags/versions of the ios SDK... Thanks!
Hi all, something in Facebook change overnight. The demo app was working fine with until probably this morning with the simple call:
[facebook requestWithGraphPath:@"me" andDelegate:self];
Now it returns:
facebookErrDomain error 10000 in the didFailWithError method:
This is with the DemoApp that I tested with the latest release and something changed on the facebook end overnight.
Hi!
I'm having a problem when trying to publish a stream. The problem occurs when:
The session is correctly restored (my friends are displayed), but when I want to add a run, and the FB dialog appears, the dialog shows the following error:
"An error occurred with 'my_app_name' . Please try again later."
I've added FBDialogDelegate's dialog:didFailWithError: method to the sample, and when I click the "ok" button in the FBDialog, the following is printed to xCode's console:
Error Domain=facebookErrDomain Code=110 UserInfo=0x4d58830 "Operation could not be completed. (facebookErrDomain error 110.)"
What can it be? How can I fix this? This is actually happening to me in my own app, but I've also been able to reproduce it in theRunAround app, and that's why, above, I enumerate the steps to reproduce the issue using that sample.
Thanks you very much!
hi
i am evaluating the ios sdk in 3.1.2 and i had encounter few difficulties.
i am getting error when trying to perform log in.
the function - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { .. }
in FBLoginDialog.m is fired up and the error is :
Error Domain=NSURLErrorDomain Code=-999 UserInfo=0x46e7a80 "Operation could not be completed. (NSURLErrorDomain error -999.)"
any ideas
Tamir
I've plugged in the new Facebook connect iOS sdk and it was working fine before Aug 23. But then whenever I tried to attempt facebook login it gives the connection error as below.
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo=0x8251030 {NSErrorFailingURLStringKey=https://www.facebook.com/connect/uiserver.php?xxx_params
I've noticed that it request for authorize on
'https://graph.facebook.com/oauth/authorize?xxx_params' and redirect to 'https://www.facebook.com/connect/uiserver.php?xxx_params' which throws an exception.
NOTE: I've checked it without HTTPS vesion and it seems to be working fine. Does anyone know why Facebook connect is not working on SSL?
How can I get username if I know user ID?
I believe the keyboardWillShow and keyboardWillHide functions should have _showingKeyboard = YES/NO before the iPad device test. That way the rotation would function same as on iPhone.
Has anything changed recently? It seems doing a request for "me" no longer works and I just get: Error Domain=facebookErrDomain Code=10000 UserInfo=0xc6279d0 "Operation could not be completed. (facebookErrDomain error 10000.)"
To reproduce this bug :
Result : I can't type. I need to double-click again into the textfield to make the keyboard work
One thing I noticed, if I put a shorter description it works
Hello, I use iphone facebook sdk to get the token, and then I use graph api(not through the sdk) to request home feed. It gives me:
{
"error": {
"type": "OAuthException",
"message": "Error processing access token."
}
}
However, this is working before, and all other graph api is working fine. Please fix this.
When I log out, then immediately try to log back in, I'll be prompted for my username and password as expected.
If I logout, then quit the app (or send to the background in iOS4) then return to the app and hit login, my old credentials seem to be remembered and I'm logged in without being asked for a password. So logging out doesn't really seem to be working completely.
In FBDialog.m line 409 you call
[self dialogDidSucceed:url]; which calls
[self dismissWithSuccess:YES animated:YES]; which in turn calls
[_delegate dialogDidComplete:self];
and in the next line (410) you call
[self dismissWithSuccess:YES animated:YES]; which calls
[_delegate dialogDidComplete:self]; again
Since my app crashed sporadically, I removed line 410 and everything works fine for me since then.
By the way: the same applies to dialogDidNotComplete
The FBRequest class needs to retain/release the delegate passed in.
Here's a case where it can crash:
The fix is to retain the delegate passed to the FBRequest object in FBRequest.m
I forked the repo and built the app fine. Taping the "login" button displays a popup with an error in it
{"error":{"type":"OAuthRedirectURIMismatchException", "message":"Missing redirect_uri parameter."}}
I did simple NSLog's to check the value of kRedirectURL
, the object pared with the key "redirect_uri", and it's set to fbconnect://success
What am I missing here?
Whenever I try to use the since or until parameters I get
Facebook returned an error Error Domain=facebookErrDomain Code=10000 UserInfo=0x4d13860 "Operation could not be completed. (facebookErrDomain error 10000.)"
Anyone have an working example of a graph request that uses the "since/date" or "until/date" in the NSMutableDictionary params?
Is it possible to add the @2x versions of the (currently two) images in the bundle? That would be very helpful. I could create them, but I'm sure Facebook has style guidelines that I don't know about--I'd hate to duplicate the effort. Here's a link for background, but I'm sure you're all over it.
Thanks!
There is no cancel button in the login dailog shown. The login page is very blank with only two textbox and login button.
Hi, I am building an app using the ios-sdk and when I use xcode's build and analyze, I get the following message in FBRequest.m
"Potential null dereference. According to coding standards in 'Creating and Returning NSError Objects' the parameter 'error' may be null."
in:
FBRequest.m:178
FBRequest.m:196
FBRequest.m:190
FBRequest.m:201
FBRequest.m:205
Is there something I can do to stop these, or is it safe to ignore them?
Thanks
Chris
Everything is working great when I first run my app (or when I run the Run Around sample app). I can log in and publish to stream.
However, when I close the app, then reopen (having stored the session information in NSUserDefaults as in the Run Around example), then I try to publish to stream, the dialog just displays the message "An error occurred with . Please try again later." (I checked and the session expiration date is a long way off, and all of the session variables seem to have been stored + restored properly).
This happens both in my app and in the Run Around sample app when I close them, storing session info, and then open them again and try to run publishStream. Is there a working way to restore a session that you could give example code for? It's pretty important for my app.
Thanks!
A request made to https://graph.facebook.com/oauth/authorize wasn't returning any expires_in parameter, which resulted in expirationDate being nil and the isSessionValid method returning false.
This caused all of my calling methods to fail.
I couldn't work out if this was an issue with Facebook or the SDK.
The only thing I get out of the /me dict for param "email" is "apps", not the full email, eg "[email protected]".
Hello. Why using this code?
$friends = json_decode(file_get_contents( 'https://graph.facebook.com/me/friends?access_token='.$session['access_token']) );
I can get successfully my friends list, and when I use this below:
$feed = json_decode(file_get_contents( 'https://graph.facebook.com/me/feed?access_token='.$session['access_token']) );
.... Why Do I get the array $feed empty?
I know I have feeds because entering by http://developers.facebook.com/docs/api and clicking in https://graph.facebook.com/me/feed I can get my feeds correctly.
I realised that entering by http://developers.facebook.com/docs/api the access_token parameter is not equal than $session['access_token']. Why?
Hi!
I was wondering if there's a way to set a default email in FB login dialog's textfield.
In the past, calling this code
NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSHTTPCookie* testCookie = [NSHTTPCookie cookieWithProperties:
[NSDictionary dictionaryWithObjectsAndKeys:
[HTTPRequest encodeURLString:email], NSHTTPCookieValue,
@"lxe", NSHTTPCookieName,
@".facebook.com", NSHTTPCookieDomain,
@"/", NSHTTPCookiePath,
@"FALSE", NSHTTPCookieDiscard,
nil]];
[cookies setCookie:testCookie];
Before this:
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:_session] autorelease];
dialog.delegate = delegate;
[dialog show];
Used to work...Any ideas of how can these work with this new sdk?
Thanks!
I am implementing FBConnect into my application and it works perfectly on simulator. When I try to run it on device, the FBLoginDialog box shows up for a couple of seconds (with a spinner) then closes immediately. When I trace the fail I found that it was immediately failing with an error:
Error Domain=kCFErrorDomainCFNetwork
Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be \u201clogin.facebook.com\u201d which could put your confidential information at risk."
While investigating on Google I found this may have something to do with SSL certificates but I am unaware on how to resolve it. Any help would be much appreciated.
When user canceled the dialog, I believe some other functions should be called instead of dialogDidComplete.
Hi there,
I haven't thoroughly delved into the code yet, but looks like whenever I run both the examples, I get the same json object-error from facebook: "error": {
"type": "OAuthInvalidClientException",
"message": "Missing client_id parameter."
}
Somehow, the login params are not passed in the main URL (https://graph.facebook.com/oauth/authorize). Is there a quick fix to alleviate the problem? I checked out the latest code from your git repo, but has this bug... I also used the kAppId of a sample facebook app that I created a week ago, but like I said, the params in FBLoginDialog::initWithURL are not passed in the URL. I'll continue debugging your library, but I was wondering if you have a quick fix.
Also, the UnitTesting code breaks, because it doesn't find the main application's window at launch-time (it's null).
Thanks so much!
Fotios
One of my users keep getting connections errors when starting the app and doing a authorize:
Says he gets "error ref. #7.e1d434d.1282759386.0"
He can access touch.facebook.com, m.facebook.com and https://graph.facebook.com just fine from Mobile Safari. Any idea what might be causing this?
It is clear that the code presented here is not suitable for production in any shape or form.
This code is the fruit of a lot of work but it is not ready yet. Almost none of the capabilities are stable. Please indicate the link to the previous version of the SDK on FaceBook's website and uncover this code once it is stable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.