Talk:Facebook Connect for iPhone
From Facebook Developer Wiki
[edit] Facebook Connect for iPhone issue
Hi,
I've install the sample app that comes in fb_connect.zip. Unfortunately, when i hit connect, it fails & I get: "Invalid API Key specified". Even my own my app fails. Is something going on? This started for me 2 days ago.
Regards
- Please file a bug and provide as much information as possible to help us reproduce the issue. Thanks, Pete (563683308 11:11, 25 June 2009 (PDT))
[edit] FBFeedDialog Questions
I am doing a feed update using FBFeedDialog with a single line , and generating an an html link in the feed. It succeeds in posting, but I see some issues:
1) The link is clickable if I view it from a regular web browser, but if I view it from the facebook iPhone app, it's not clickable. Is there anything that can be done about it?
2) I've also tried creating the link by including it in a status update using [[FBRequest requestWithDelegate:self] call:@"facebook.Users.setStatus" params:params]; In this case, I was unable to make the <a> tag work and the result was posting an ugly URL. But the good news is I get something that's clickable from the facebook iPhone app. Is there something I'm missing here?
3) Ævar- Am I correct to assume that the feed dialog is in fact outdated along with the template system, I cannot see or change my feed templates under my application, only this message:
"Facebook will deprecate template bundles and their related API calls December 20, 2009.
Please start using stream attachments with stream.publish, FB.Connect.streamPublish, and Facebook.streamPublish instead."
I am however unsure how to use the new stuff, especially with the iphone client. Also do all images related to template have to be bundled with application, or at least the links to them? Any help would be appreciated
- Ævar, are you using FBStreamDialog for publishing? If so, then you should use stream attachments, and not template bundles. If you're still using FBFeedDialog, then you should update your code to use the new class. Pete -- 563683308 10:44, 9 November 2009 (PST)
[edit] "Connect" Sample App Crashes after Login on Simulator
I downloaded the source code, opened the XCode project and the only thing I changed is the API key and Application Secret. After the login screen, attempting to click any of the "Logout" "Get Permissions" or "Publish to Feed" buttons throws me back to XCode with a ___Terminating Due To Uncaught Exception___
- Hi Max, can you file a bug with all this information, please? Thanks, Pete (563683308 13:19, 13 July 2009 (PDT))
I've got the Facebook Connect for iPhone login flow working and I was wondering whether how I can pass the credentials/session to a UIWebView so that the webview is logged in as well?
[edit] Feed Get
I'm trying to ascertain what data we can get from the users feed to display. Can we just get the news feed? Can we get wall only? Can we just get status updates? There is lots of info on publishing but far less on reading/displaying information posted to a users profile.
- Are you following the instructions under Using the API? If you're seeing inconsistent results as to which methods work, and which don't, please share that here and we can take a look. Thanks, Pete (563683308 22:54, 12 August 2009 (PDT))
Pete. I'm still trying to ascertain from the documentation what is available or different for facebook connect on iPhone versus the facebook api. I'm reading the API but wanting to know what I can integrate into the iPhone versus a Facebook App. Will all the calls in http://wiki.developers.facebook.com/index.php/API also work via Facebook Connect in the iPhone environment? It looks like you can make calls to the api if I read http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone correctly. Just trying to research any limitations beforehand.
- If you're passing your application secret, then you can use any API method. However, given that we recommend you don't include your app secret (since a malicious person can decompile your app code and get it), you're likely using the session proxy method. If you're using a session proxy, then you can't call any methods that require an application secret (the admin.* methods, the Data Store API methods, the Permissions API, fbml.* and users.getStandardInfo. I created Session Secret and API Methods, which documents which methods that require an app secret, and which ones don't. Pete (563683308 12:35, 20 August 2009 (PDT))
[edit] Shouldn't sessionKey be changing after logout and login?
Does the sessionKey I am getting after session:didLogin ever change? So far it's been the same, even after logging out.
- This sounds like a bug. Can you file one please? Thanks, Pete (563683308 02:14, 14 August 2009 (PDT))
[edit] performing request with mutable array that contains a mutable array leads to crash
I am trying to submit a publish.stream request using the API and when I include a mutable array for the attachment the application crashes. By debug it looks to be an issue with the variable joined but I am not sure. Here is the code:
NSString *message = @"Hello";
NSDictionary *attachment = [NSDictionary dictionaryWithObjectsAndKeys: self.title, @"name", self.href, @"href", self.description, @"description", nil];
Causes crash:
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: message, @"message", attachment, @"attachment", nil];
Does not cause crash: NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: message, @"message", nil];
Let me know what I am doing wrong.
Tim
- Hi Tim, we'll need to investigate this issue further. Please file a bug with this information so we can look into the issue. Thanks, Pete (563683308 12:35, 20 August 2009 (PDT))
[edit] How to upload a video to facebook using iphone
I have tried uploading the image from iphone, which is working pretty fine, but i am not able to upload the video, i think i am lagging at "video" parameter, what object do i need to send to the "video" parameter, the below is the code :
NSMutableDictionary *args2 = [[[NSMutableDictionary alloc] init] autorelease]; [args2 setObject:[NSData dataWithContentsOfURL:[self localMovieURL]] forKey:@"video"]; FBRequest *videoUpload = [FBRequest requestWithDelegate:self]; [videoUpload call:@"video.upload" params:args2];
(or)
NSMutableDictionary *args2 = [[[NSMutableDictionary alloc] init] autorelease]; [args2 setObject:@"movie.m4v" forKey:@"video"]; FBRequest *videoUpload = [FBRequest requestWithDelegate:self]; [videoUpload call:@"video.upload" params:args2];
nothing is working for me.
[edit] How to change the API url in runtime
I want to upload the video from iphone, and this call has to be made on "http://api-video.facebook.com", but by default the facebook SDK has fixed the url to "http://api.facebook.com" in "FBSession.m" class, if i run with this url i get error, i have changed this static variable then its working for video but other requests are not working , its is something like we should be able to change the api url in runtime .
---
looks like they built in support, but havnt yet updated the API. In FBRequest.m on line 80, add the following code to the method... its a hack, but it works:
- (NSString*)urlForMethod:(NSString*)method {
if([method isEqualToString:@"video.upload"]) return @"http://api-video.facebook.com/restserver.php"; else return _session.apiURL; }
I am still unable to get the upload to work however ( think im constructing the call wrong. Would you be kind enough to post the FBRequest code that you're using to upload the video? Thanks.
[edit] Is it possible to save login data of user to avoid re-login everytime he launch the App?
Because if I don't save the user's data, everytime he opens my App for using it, he must re-login! There isn't a method to store these data?
- You can prompt the user for the offline_access extended permission so the session you'll get from the user never expires. Pete (563683308 11:56, 8 September 2009 (PDT))
[edit] 3.1 Device only compile error -
In OS 3.1, on the device, XCode/Cocoa does not allow you to synthesize properties that reference ivars from the superclass, and compilation fails. Unfortunately, the FBConnect code has an example of this on line 30 of FBLoginDialog.m:
@synthesize session = _session;
This results in this error when trying to compile for 3.1/device:
FBLoginDialog.m:30: error: property 'session' attempting to use ivar '_session' declared in super class of 'FBLoginDialog'
Oddly, simulator works fine; and older SDKs work fine. But my app requires the new 3.1 camera APIs, so I'm stuck!
UPDATE: If you just remove that line, everything just works fine (since the superclass already has that property synthesized). That should probably be merged into the code.
- I shared your issue and your workaround with our engineering team. Thanks for reporting -- we're looking into it. Pete (563683308 17:40, 23 September 2009 (PDT))
[edit] How do I see if a user already has extender permission?
I have all the prompts working, but I don't want to prompt the user for extended permission if they have already granted it.
I don't see an API in FB connect to check this.
Are you going to add? Can you give me some direction on how I should add if you aren't planning to soon?
- Hi Jon, just call users.hasAppPermission. Pete (563683308 12:00, 28 September 2009 (PDT))
[edit] App Logo Dimensions
I am trying to figure out the dimensions of the logo to have in the settings to be displayed properly on the phone.
I tried everything and it is always blurry
any clue about the exact dimensions for the app logo to be uploaded in the connect tab in the application settings
-Hosam
- As per Creating_a_Platform_Application#Configuring_Facebook_Connect_Settings, the logo needs to be 99x22 pixels. Pete -- 563683308 11:05, 19 October 2009 (PDT)
[edit] Instructions on adding FBConnect have an unstated assumption that user will not copy files into project.
The instructions should state that you should *not* follow the standard best practice of checking 'Copy items into destination group's folder (if needed)' when dragging the FBConnect group into your project; otherwise things break. This is clear in the video, but it would be nice if it was also stated in the written instructions so people who skip the video can get it right on the first try.
- But the default for me in XCode is that the copy files check box is not enabled, so the docs are following the default case. Still, I'll add a clarifying statement here. Pete -- 563683308 15:41, 11 November 2009 (PST)
[edit] Errors after following instructions in video
I followed the instructions in the video [1] exactly and Xcode (3.2.1) reports 101 build errors about missing header files, starting with
/Users/usr11/Coding/xcoding/iphone/FbApp/../../fbconnect-iphone/src/FBConnect/FBSession.h:17:0 FBConnect/FBConnectGlobal.h: No such file or directory in /Users/usr11/Coding/xcoding/iphone/FbApp/../../fbconnect-iphone/src/FBConnect/FBSession.h
- Did you copy the FBConnect group files into your project's folder? If so, you'll need to change your project settings to point to the directory where you copied them. Pete -- 563683308 15:47, 11 November 2009 (PST)
[edit] Best practice for application flow for status updates after already being logged in
My FBConnect code seems to be working. But I have a question about best practices for the UI code surrounding the FBConnect experience. I'll say what I'm planning and hope you will comment on whether this fits into FB expectations about how this kind of thing should work.
Users solve a puzzle, and they get asked "Do you want to tell your friends you solved this?" and next to that, there is a Connect button. They can connect at that point by touching the button. When they connect, the didLogin delegate method is fired and it shows a dialog with a preview of the proposed status update, and all is fine. But if they then continue in the same session and solve another puzzle, they come back to the same screen, and it prompts them, but the button now says "Logout."
I guess what I need to do is manually detect they are already logged in, then show my own button (with my own homegrown Facebook styling?) with a button label of something like "Update status" and the same caption as before (Do you want to tell..). Then if that button is touched, I need to manually put up the dialog showing a preview of the status update and asking for confirmation.
Does Facebook have any guidelines about this? Does this flow make sense? Or would you recommend just showing the dialog every time they could potentially want to do a status update, once I detect that they're already logged in? This is less work for me and doesn't require me to make a custom button that follows the Facebook style, but it seems like it could become annoying to users.
- Feel free to create your own button, or use the Facebook favicon. You don't need to show the Connect dialog again. Also, you can always ask for help on the Developer Forum. Thanks, Pete -- 563683308 14:42, 12 November 2009 (PST)
