Facebook sharing on app doesn't work - facebook

I use social framework for Facebook and Twitter sharing integration into app. On the iPad Air iOS 8.1 it doesn't work for Facebook.
-(IBAction)Facebook:(id)sender{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *FACEBOOK = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[FACEBOOK setInitialText:[NSString stringWithFormat:#"Wow, look at my new high score!"];
[self presentViewController:FACEBOOK animated:YES completion:nil];
}
else{
UIAlertView *alert =[[UIAlertView alloc]initWithTitle:#"FaceBook Signed Out" message:#"Add or create Facebook account in Settings." delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
}
}
For the above iPad Air iOS 8.1, nothing at all appears in shared message.
However, for iPad non-retina iOS 8.1.2, the above code works fine and message appears in shared message.
What's going on? Even the signed out message doesn't appear as I stated in code for iPad Air iOS 8.1. Why isn't it working on all iOS 8's or is this an iPad Retina issue?

Any form is prefilling is not allowed, as stated in the policy. Previously it was still possible using setInitialText, but recently this has been also been enforced on the software side. Any values provided here are not used in the dialog.
In this case, it's actually a bug (or limitation of the platform) that it is still working on the non-retine iOS 8.1.2 iPad. Please don't rely on this; in a next update this might also become enforced through software.

Related

SLComposeViewController "Facebook not available"

I'm using the code snippet which was posted on my previous question, Simple way to add Facebook/Twitter share to app?
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[slComposeViewController setInitialText:#"Your text"];
[slComposeViewController addImage:[UIImage imageNamed:#"NameOfImage"]];
[self presentViewController:slComposeViewController animated:YES completion:nil];
} else {
//Show alert or in some way handle the fact that the device does not support this //feature
NSLog(#"Facebook not available");
}
But when I run it on the device and in the simulator all I'm getting is "Facebook not available", what could I be doing wrong?
I've looked at the available tutorials, and I've included the libraries that are required, so I'm not sure what else I'm doing wrong.
In Settings.app/Facebook, you need to set up an account.
SLComposeViewController only allows you to posts on FaceBook if you have an account. That's normal behavior, that's how FaceBook works: No account, nothing to do there.
Since iOS6, you can enter your account in iOS allowing apps to use this account with some of the iOS framework without importing the Facebook SDK. Of course, you have little options with the Social.framework, and if you want to do more, like timelines, etc. you'll have to use the FaceBook SDK.

How to implement twitter login functionality on iPhone

I've already tried to use Facebook login functionality. During the login I got user token and using this token I could identify user. So, Facebook is OK for me.
1) How can I implement login functionality with Twitter? Will I get anything the same like user token on Facebook?
As far as I know, to use twitter API user should be login in twitter in the settings of iPhone. Can I implement anything to enable user to login even he is not yet logged in in the settings of iPhone?
2) After user login I want him to invite his twitter friends to my application. Is it possible to do? And in what ways?
I will be grateful for some code examples.
Please check the link below each and every step is clearly told by Twitter itself.
https://dev.twitter.com/docs/ios
If you still having problem please follow the link
http://www.raywenderlich.com/5519/beginning-twitter-in-ios-5
That contains the code and all steps !
Hope it will help you !
Please go through this link
it will provide stepwise details.
add
#import <Twitter/Twitter.h>
Then you can tweet something using:
-(IBAction)tweetTapped:(id)sender {
{
if ([TWTweetComposeViewController canSendTweet])
{
TWTweetComposeViewController *tweetSheet =
[[TWTweetComposeViewController alloc] init];
[tweetSheet setInitialText:
#"Tweeting from iOS 5 By Tutorials! :)"];
[self presentModalViewController:tweetSheet animated:YES];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:#"Sorry"
message:#"You can't send a tweet right now, make sure
your device has an internet connection and you have
at least one Twitter account setup"
delegate:self
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alertView show];
}
}

How to check if Location Services is On or not?

How can I check if the user has turned off Location Services ?
So that I can prompt him/her to turn it On in order to use my app.
Thank you !
The CLLocationManager provides class methods to determine the availability of location services:
- (BOOL)locationServicesEnabled (for < iOS 4.0)
+ (BOOL)locationServicesEnabled (for iOS 4.0 and greater)
+ (CLAuthorizationStatus)authorizationStatus (for iOS 4.2+)
(and others, see documentation)
If your application absolutely cannot run without Location Services, then you can make Location Services a requirement for installing/running your app using the app's Info.plist. You do this by adding the UIDeviceCapabilities key to your app's Info.plist and giving it a corresponding value of "location-services" minus the quotes.
With the Info.plist configured this way, if Location Services are turned off, or if the device is in airplane mode, or anything else is preventing the use of Location Services on the device, iOS will prompt the user to turn on Location Services when the app is opened.
EDIT: Brief experimentation seems to indicate that iOS does not prompt the user in this circumstance, so this would not be a good solution for you.
For more information, you can look at the Information Property List Key Reference section of Apple's developer documentation.
Use the below piece of code...
if (![CLLocationManager locationServicesEnabled]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Location Service Disabled"
message:#"To re-enable, please go to Settings and turn on Location Service for this app."
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
Use the following code, which will work even in iOS 8.
if([CLLocationManager locationServicesEnabled]&&
[CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied)
{
//...Location service is enabled
}
else
{
//...Location service is disabled
}

FBLoginDialog auto ask for Basic Permission before didLogin

I am using the old facebook iphone sdk to develop a iphone app: https://github.com/megastep/facebook-iphone-sdk
I am currently encountering a problem: The FBLoginDialog auto ask for Basic Permission before the didLogin callback.
I want to skip this part as I want to ask Exteneded permission.
And idea why facebook is asking the basic permission before the callback didLogin?
Thanks.
FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:session] autorelease];
// dialog.delegate = self;
[dialog show];
You need to move to the new SDK. The SDK you are using is known to be buggy in several ways, it leaks memory and has problems on the 4.2 OS when the user is editing text and the keyboard is on screen.
Note also that the new SDK makes it extremely easy to ask for whatever permissions you need, you can just do it in the authorize:delegate method (see the sample project included in the sdk for an example).
Edit/Update:
Facebook asks for basic auth before didLogin because the user has to at least authorize your application.

Facebook Connect issue with the iPhone

I have to integrate FaceBook connect with the iPhone App.
I downloaded SDK, added new app on the facebook.
But I have a problem. All samples and tutorials contains feature with feeds publishing.
In the sample which included in the SDK I have to insert Template Bundle Id instead of '9999999':
- (void)publishFeed:(id)target {
FBFeedDialog* dialog = [[[FBFeedDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.templateBundleId = 9999999;
dialog.templateData = #"{\"key1\": \"value1\"}";
[dialog show];
}
Where can I create templateBundleId? I can't found how to create it in the Developer's Tools.
May be templates is deprecated. If it's true then what can I use for publishing on the FB? And how can I do it with the iPhone SDK?
You create the templateBundleId in the console - http://developers.facebook.com/tools.php