I am showing a dialog in an iOS app to allow users to select some friends to whom send an invitation to the app.
The dialog is displayed, you can select some friends and press send.
Dialog delegate method callback is called successfuly.
So far so good, but the friend is not receiving any invitation,
is that because the app is still in development?
This is the code I am using to show the dialog, is there any missing parameter?
(access token is fine because the app works).
// Show the UI Dialog
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kFacebookAppID,#"access_token", #"Invitation message", #"message",nil];
[facebook dialog:#"apprequests"andParams:params andDelegate:self];
Requests are only delivered if the user can reasonably be expected to accept them; if your app is only an iOS app (i.e no canvas implementation / apps.facebook.com URL) then they'll only be displayed in the Facebook app for iOS.
If this isn't happening it may be because your SSO settings for the app aren't correct, so Facebook's app doesn't know how to bring users to your app when they accept the request, check those first - making sure the URL handler is set up correctly in your app, etc.
It may also be because the app is in sandbox mode, but i'm not sure about that one.
Related
I have a custom url scheme working well, but there is one small behaviour I am hoping to change... Currently the inbound url is captured and processed in the following code (so, all good here):
- (void) handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
//I parse and deal with the url here//
}
Is it possible to avoid my app becoming the frontmost application? Whenever the url is received, my app is open already, as I initiated the communication from this app, and are merely listening for the reply. However, sometimes the call is made via an NSTimer so my app may or may not be the frontmost app. I don't want to disrupt the workflow if I am currently say browsing pages in Safari by having my app take the focus from Safari. I hope this makes sense.
Is this possible?
For anyone who's interested i instead set up a group container. I save my payload to the group defaults and then send an NSDistributedNotification from my helper app. The main app gets the notification, and reads the payload data from group defaults.
Such a workaround... but its necessary as both the main and helper apps are sandboxed.
I also discovered that KVO on group defaults doesn't work in the sandbox, and neither does sending a userDictionary in the NSDistributedNOtification.
:(
I have had to write sooo much extra code to make my app play nicely in the sandbox.
I have little Confusion regarding my iPhone application. So I hope I got solution from here.
Now My Question is:
Currently I am developing an iPhone application with Facebook user integration. User can send application request to his/her friend as a Facebook notification. If receiver accept that request or click on that request then how should I detect that through my iPhone application? Or is there any way to show that notification in my iPhone application?(Functionality is like get Life by Friends in Candy Crush Game)
Some Points
I have created canvas for application integration with Facebook but there is no any kind of functionality on my application's canvas page. It is totally blank. I just want application on iPhone not on Facebook.
On every click on app invitation notification by receiver I want to give some points to notification sender.
If you have any king of link or document related to this topic then please send me.
A Facebook app is setup with iOS native app enabled with bundle id and App Store Id of another app.
Following are possible in the current scenario.
1.Sending an app request to a friend,
2.The request badge appears in the friend's Facebook,
3. And clicking on the request launches my app.
This was the link i referred to implement this.
https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/#protip3
I am supposed to get a NSURL from these functions
– application:openURL:sourceApplication:annotation:
OR
– application:handleOpenURL:
and the expected format is as follows.
fb[APP_ID]://authorize#expires_in=[ACCESS_TOKEN_EXPIRATION]
&access_token=[USER_ACCESS_TOKEN]
&target_url=https://apps.facebook.com/[APP_NAME_SPACE]/?request_ids=
[COMMA_SEPARATED_REQUESTIDs]&ref=notif&app_request_type=user_to_user
Here the request_ids contains The id of app request send, and which can be used to get the data attached to the App Request.
Now my issue is that, I am not getting the NSURL in expected form, instead I get the following format. So I am unable to find or use the request_ids.
fb[APP_ID]://authorize#expires_in=[ACCESS_TOKEN_EXPIRATION]
&access_token=[USER_ACCESS_TOKEN]
&target_url=https://apps.facebook.com/application.php?id=442634372448098
I need to send a request throw my app to user's friends in Facebook (After the app on Facebook is authorized) I know there is a way to do it through the SDK :
[self.facebook dialog:#"apprequests" andParams:params andDelegate:nil];
But I don't need that way to show the dialog I just need to be able to send the request in the background when the user select the friend from (Table View for example).
Is this possible?
The Facebook Dialog API has not been updated (yet, hopefully). You can't bypass the dialog the way you want to do it.
But, you can :
preselect the friends with your own GUI and gives the apprequest the selected facebook ids. This way, the dialog is just to confirm the request.
activate the frictionless parameter, to avoid the dialog the next time you send the request for the same selected friends (the confirm dialog seems to show anyway, though, and immediately disappear, it gives a not-so-nice blink on the screen).
here's the related documentation, in case you need it : https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/
I am using FBConnect in my iOS project to authorize the user (SSO).
Once logged in, I sometimes need to open a Webview in order to show the user specific dialogs such as the app request dialog (invite to app) and even to open a friend's profile page in a webview for my app user to browse.
The problem is that the Webview doesn't recognize the logged in user and asks him to login again, this is not very friendly.
Any ideas how to share the logged in auth key/cookie/something with the webview?
You are likely running into this situation. It's really frustrating.
Facebook iOS SDK not storing cookies for access
You can, if you want, force the iOS library to use your app for login, and authorize through a UIWebview local to your app. You are thus logged in, and have cookies to use. You'll have to add a method to the existing Facebook object. Normally, you call:
- (void) authorize:(NSArray *)permissions
delegate:(id<FBSessionDelegate>)delegate
to authorize, which in turns calls the private method:
- (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth
safariAuth:(BOOL)trySafariAuth
with both parameters set to YES.
You want to add a public method that calls the same private function but with both parameters set to NO. I added this method to Facebook.m and declared it in Facebook.h so I could call it however I like:
- (void)authorize:(NSArray *)permissions
tryFBApp:(BOOL) tryFBApp
trySafariAuth:(BOOL) trySafariAuth
delegate:(id<FBSessionDelegate>)delegate {
[_permissions release];
_permissions = [permissions retain];
_sessionDelegate = delegate;
[self authorizeWithFBAppAuth:tryFBApp safariAuth:trySafariAuth];
}
I call that with the two BOOL parameters set to NO, and the library pops ups a local UIWebView that leaves me with cookies that work for the app.
FBConnect returns you a token so that you have access to the FB API not the FB website. Unfortunately this doesn't login them in through a UIWebView and set the proper FB cookies.
Another strategy would be to change in the FBConnect source code to redirect to your own UIWebView instead of the standard FB pop-out to the FB-APP process and have them login only once. You would however have to persist the cookie state of the UIWebView.
I suggest that you also take a look at http://www.getsocialize.com which can help you manage social network integration.
good luck!