Sharing photos on facebook from iOS application without facebook app - ios

Is it possible on iOS < 6?
In iOS 6+, I can share using message composer.
What about previous version of iOS? FB SDK share uses facebook app id so it's not the way.
Maybe i can open native facebook app with scheme like fb://share/photo/[image_data]?
Any other ideas?

For iOS < 6, you can always used ShareKit plugin.
In this repository, they share nice example to share image on your fb account.
Have a look at the class ExampleShareImage:
- (void)loadView
{
[super loadView];
self.imageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:#"sanFran.jpg"]] autorelease];
imageView.frame = CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height);
[self.view addSubview:imageView];
}
- (void)share
{
SHKItem *item = [SHKItem image:imageView.image title:#"San Francisco"];
/* optional examples
item.tags = [NSArray arrayWithObjects:#"bay bridge", #"architecture", #"california", nil];
//give a source rect in the coords of the view set with setRootViewController:
item.popOverSourceRect = [self.navigationController.toolbar convertRect:self.navigationController.toolbar.bounds toView:self.view];
*/
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[SHK setRootViewController:self];
[actionSheet showFromToolbar:self.navigationController.toolbar];
}
You can also integrate FBConnect framework provide by Facebook.

Related

Facebook messanger missing in UIActivityViewController options

I am using UIActivityViewController to share some data on different social media options.
I can see Facebook but i am unable to see Facebook messenger. Does any body have any idea why i doesn't appear in the options list?
I have both Facebook and Facebook messenger installed in my iPhone.
UIActivityViewController * shareViewController = [[UIActivityViewController alloc] initWithActivityItems:#[activity] applicationActivities:nil];
if(self.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassRegular && self.traitCollection.verticalSizeClass == UIUserInterfaceSizeClassRegular) {
shareViewController.popoverPresentationController.barButtonItem = self.shareButton;
}
[self presentViewController:shareViewController animated:YES completion:^{
}];
Any help will be great thanks

Admob showing ads in simulator but not in device

This is the code that I am currently using to show some ads on my device. But it doesn't seem to work as of now. Need some guidance on what could be going wrong here.
self.adBanner = [[GADBannerView alloc]
initWithFrame:CGRectMake(0,468,320,50)];
self.adBanner.adUnitID = #"a153b29f919d822";
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
//self.adBanner.center = CGPointMake(self.view.center.x, self.adBanner.center.y);
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[self.adBanner loadRequest:r];
Thanks.
If you have recently setup up your account in Google AdMob, it is going to take sometime for the ads to start appearing on the device.
But you can try setting testDevices in your GADRequest. The device Id will be being printed out in your console by the AdMob SDK.
Then add the below code.
r.testDevices = #["test_device_id"];

Facebook API permissions in iOS

I'm working on an app that uses the Facebook SDK. Until now I've not had any significant problems. I've been using the API to request a user's photos. However, after deleting the app on the device to try out some log-in scenarios, the app now only requests the public profile.
This is the call being made
self.loginView = [[FBLoginView alloc] initWithReadPermissions:#[#"public_profile", #"email", #"user_friends", #"user_photos"]];
but this is what shows on the device
When I request the user's photos the data is empty (as you'd expect with just the public profile).
What did I do to break it? And more importantly, how do I fix it?
EDIT: I've created a new app on the Facebook developer portal and I get exactly the same results.
For reasons I can't establish, this error was somehow connected to the way that the FBLogin was initialising.
In my app I had created an FBLoginView in the storyboard and I was doing the alloc/init in the viewDidLoad method of the view controller handling my Facebook information.
I had checked to ensure that the FBLoginView class was associated with the view in the storyboard and that the FBLoginView class was declared in my app delegate.
However, I was seeing the problem as stated. It was only when I removed the FBLoginView from the storyboard and created it programmatically (as in the FBLoginUIControlSample that's available on Facebook) that the problem was resolved.
For reference, this DID NOT work for me
-(void)viewDidLoad{
[super viewDidLoad];
self.loginView = [[FBLoginView alloc] initWithReadPermissions:#[#"public_profile", #"email", #"user_friends", #"user_photos"]];
self.loginView.delegate = self;
}
This DID work.
-(void)viewDidLoad{
[super viewDidLoad];
FBLoginView *loginView = [[FBLoginView alloc] initWithReadPermissions:#[#"public_profile", #"email", #"user_friends", #"user_photos"]];
loginView.delegate = self;
loginView.frame = CGRectOffset(loginView.frame,
(self.view.center.x - (loginView.frame.size.width / 2)),
5);
loginView.center = self.view.center;
[self.View addSubview:loginView];
}

Admob Banner doesn't show

I want to implement Admob into an app for iPad in landscape mode, I followed step by step tutorial for admob, on adding advertising to the app. I added all the frameworks and requirements given to work correctly.
I can't see the banner. I tried both the simulator and on the device itself. According to the following link it seems that:
"Test ads are not supported on iOS 6 devices; use the simulator instead"
The compilation is correct without issues.
I changed the background of the red banner, and I moved all the views that would hide the banner, but still I couldn't see it. Inside the viewDidLoad method, I have placed it in different positions
From Google admob statistics I see that increase requests, this I don't understand. O___O
The AdMob SDK is the latest.
I appreciate any help.
My code:
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_728x90.height,
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.delegate = self;
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];
bannerView_.backgroundColor= [UIColor redColor];
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
#"6A1E19F-xxxxx-xxxx-xxxxDF38593ECBD" ,
#"9bc75xxxxxxxxxxxxxxx762de7c79fb",
nil];
request.testing = YES;
[bannerView_ loadRequest:request];
try this
request.testDevices = [NSArray arrayWithObjects:#[#"GAD_SIMULATOR_ID"], nil];
[yourbannerview loadRequest:request];
and delete request.test, is disabled now :/

Share image on twitter in IOS

HI I want to share Image on twitter from my APP. I have tweet text succesfully by following code.How can I tweet image with text.
-(IBAction)updateTwitter{
if(!_engine){
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
}
if(![_engine isAuthorized]){
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
[self presentModalViewController: controller animated: YES];
}
}
if([_engine isAuthorized]){
[_engine sendUpdate:#"This is my first test"];
}
}
Have you considered using iOS 5's Twitter Framework? In particular, check out TWTweetComposeViewController, which lets you add images easily.

Resources