I'm working currently on an Air app for iOS and i have some hard time trying to make "invite friends" button. I'm using facebook-actionscript-api 1.8.1 with air 3.3 and I have something like this in my code:
invite_button.addEventListener(MouseEvent.CLICK, facebookInvite);
private function facebookInvite(e:MouseEvent):void
{
var dat:Object = new Object();
dat.message = 'I invite you to this awesome app!';
dat.title = 'Super Extra Max Facebook App';
dat.filters = ['app_non_users'];
Facebook.ui('apprequest', dat);
}
Button displays only if user is logged in.
But when I tried to tap the button I got debugging error:
ExternalInterface not available on the device.
Well, I guess the meaning of this is obvious - it's trying to use JS.
How can I show friends select dialog and send invitations from within an app? I thought I can write some StageWebView container and display the dialog in it but isn't there some other, probably simpler way?
Ok, so I finally found this thread on API page in issues a while ago:
http://code.google.com/p/facebook-actionscript-api/issues/detail?id=365
5th comment links to the thing I used. It appears it is just what I needed.
Next time I'm just going to use native component...
Related
I'm developing an app for my local newspaper. When you press the "Share" button, I want the standard iOS share interface to appear allowing users to share the URL of an article with Facebook, Twitter, etc. I'm trying to use the UIActivityViewController, and while it appears, it's not giving me all of the options.
Here's the code I use:
NSObject[] activitiesItems = {
new NSString(post.Title),
new NSUrl(post.URL)
};
var activityController = new UIActivityViewController(activitiesItems, null);
PresentViewController(activityController, true, null);
When the UI opens, this is all I see (no Twitter or Facebook):
This is in comparison to what I see when I share a page from Safari, which has the Facebook and Twitter options, along with a variety of others:
What do I have to change in my code to allow more of these options to appear?
1) Your code is fine
2) On your iOS Simulator go to the Setting and login to Twitter and/or FaceBook accounts and retest your app.
iOS Simulator Setting (botton off screen):
Here is my Simulator view with me logged into Twitter but not Facebook using the same code you posted:
3) Safari is a using a custom ViewController to display what you are seeing... If you actually try to share a link via that Twitter button you will be force to login..
4) Use an actual device for complete testing of all the possible sharing applications installed.
Those options are only supposed to show when you are logged in to an account in the Settings app for FB and Twitter. They are hidden if not.
However that doesn't really explain why they show up in Safari.
Perhaps including the NSString for post.Title in the items array is causing it to exclude some sharing options.
I am making a personal website with a link to a Facebook profile. If you go to the website from iOS device, I would like the link to open in application, not safari, because a lot of people are not logged-in in safari.
Now this can be done by using "fb://profile/" instead of the link facebook.com/. And I have used following simple code to switch the links:
$(function(){
var iOS = ( navigator.userAgent.match(/(iPhone)/g) ? true : false );
if (iOS){
var href= $(".fb-link").attr("href");
var res = href.split("/");
var username = res[res.length - 1];
$(".fb-link").attr("href", "fb://profile/" + username);
}
});
The only problem is when user does not have the app, then it not only won't open in an app but will fail to open completely.
Is there a way to test if the app is installed? I know when I am programming in the iOS native app I can test if fb:// responds and then I can use the link, but the safari is way more limited. I know it probably won't be possible, just trying if anybody has some experience with this.
Also - is there something similar for android? I don't have much experience with that.
Thanks
There's no way in Safari (from a webpage) to determine whether an app is installed or not. The only thing you can try to do is do the fb://profile redirect in javascript, and then set a timeout on your page to see if the redirect succeeded or not. But this is not optimal as there can be error dialogs that pop up.
For Android, you should just go to the www url, and let the Android app handle it via its own intent filter.
I am making a webviewstage in flex mobile to display the dialog app request url of facebook , but when I am writing in the text input to autocomplete my friends, it never load anyone... what is happening...? theres another way to invite friends to my app in flex mobile?... I' am working with IOS.
Thanks
I have been in the similar problem 2 weeks ago, but I managed to create a native extension , which is an iOS library you embed into your flex project, it displays the FB dialog with app request with the list of your suggested friends, you can do the same, if you need more help, let me know.
I would like to know whether it is possible to add a Facebook Like button to a native iPhone app. In the app, the user browses a business directory or deals. When they tap on an item to view the details, it would be nice to have a Facebook Like button that can be used to post the item to the user's Facebook page.
Facebook writes: "Currently, the Like button is only available in mobile web apps".
My app is a native app and not a web app, so therefore I assume it's not possible. However, I do assume that it is possible to mix native UI components on a screen along with web components and therefore it might be possible to implement the Like button, although I am not sure how you pass data from the native portion to the web portion.
If the only solution is a hack, then I won't implement it because at some point the hack will fail when Facebook alters their API.
read around SO a little, you get many leads. Here's one:
Like button in iOS application
And a comment points to github.com/brow/FacebookLikeView
It has same caveats, but it seems there aren't any magic solutions.
There are these blogposts as well:
http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html
http://petersteinberger.com/2010/06/add-facebook-like-button-with-facebook-connect-iphone-sdk/
But not sure you get a native UIButton. Maybe you can open a webview in the background and emulate a click on it...
GL, update if you have some findings,
Oded.
Now you can use the FBlike button using the following code but it need to download latest sdk and it is the beta version :(
Here is the code:
[FBSettings enableBetaFeature:FBBetaFeaturesLikeButton];
[FBSettings enablePlatformCompatibility:NO];
FBLikeControl *like = [[FBLikeControl alloc] init];
like.objectID = #"http://shareitexampleapp.parseapp.com/photo1/";
like.likeControlHorizontalAlignment=FBLikeControlHorizontalAlignmentRight;
like.likeControlStyle=FBLikeControlStyleBoxCount;
[self.view addSubview like];
It looks like Facebook finally decided to allow this, more directly, via the Open Graph API.
See documentation here
Check this out, FB just made it possible through their SDK. Only for testing and ios for now
https://developers.facebook.com/docs/ios/like-button/
Does anybody know how to place Facebook "like" button into iOS application? I've tried the method described in this blog post. But I do not really like this method, because its ugly Login dialog. And, what is more important, it makes user login twice. For example, user wants post a message to his wall if he isn't logged in I call standard FBLoginDialog, after that user posted a message he may want push "like" button and he have to login again - it is really bad user experience.
How to be? How can I give user "like" feature in my iOS app?
That is actually the only way to do it. There is no special iOS like button. However, the good news is that just today Facebook announced single sign in support for mobile apps. This should remove some of the burden the user faces to log in to facebook.
It seems there is an agreement on not being able to do this. This question shows you can, as does the FB Graph API documentation:
You can comment on or like any object that has a /comments or /likes
connection by posting to https://graph.facebook.com/OBJECT_ID/comments
and https://graph.facebook.com/OBJECT_ID/likes, respectively.
Unfortunately, according to this question you can’t like a page.
I like using ShareKit: http://www.getsharekit.com/
It's not exactly what you're looking for, but still...
The only way supported by Facebook on any platform (web, mobile, etc) is from their iFrame code. From iOS, that means embedding a UIWebView into your application with the iFrame code. Note that it does require them to login via Safari.
- (void)addLikeButton{
[FBSettings enableBetaFeature:TRUE];
[FBSettings enablePlatformCompatibility:NO];
_like = [[FBLikeControl alloc] init];
_like.frame = CGRectMake(60,12,200,33);
_like.likeControlAuxiliaryPosition = FBLikeControlAuxiliaryPositionInline;
_like.likeControlHorizontalAlignment = FBLikeControlHorizontalAlignmentLeft;
_like.objectID = #"https://www.facebook.com/pages/Strana-Gapra/1377227779244834";
_like.likeControlStyle = FBLikeControlStyleStandard ;
[_like addTarget:self action:#selector(onSelect:) forControlEvents:UIControlEventValueChanged];
[self.likeView addSubview:_like];
[self performSelector:#selector(getLikeSubviews) withObject:nil afterDelay:0.6];
}