Facebook, Twitter icon not showing in UIActivityViewController on iOS7 - objective-c

I have added this code for presenting a UIActivityViewController:
-(IBAction)activityAction:(id)sender
{
UIActivityViewController *activityViewController = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:#"Hello Welcome!",[UIImage imageNamed:#"scene3.jpg"],nil] applicationActivities:nil];
activityViewController.excludedActivityTypes = #[UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
[self presentViewController:activityViewController animated:YES completion:nil];
}
Facebook, Twitter and Weibo icons are not showing in iOS7. In iOS6, all the icons are showing correctly. See the screenshot below:
How can I solve this?

You're probably not logged in to Facebook or Twitter in the devices Settings. They won't show up here unless the user is logged in. File a bug with Apple.

Look at the name of the property excludedActivityTypes, you are excluding facebook, twitter, ...
activityViewController.excludedActivityTypes = #[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
excludes only Weibo and Assign to contact

Make sure that you don't exclude the Activities that you want to use.
So, remove "UIActivityTypePostToFacebook" & "UIActivityTypePostToTwitter" from "activityViewController.excludedActivityTypes" object.
Also, Make sure that you are logged in into Facebook and Twitter accounts in order to post on respective social platform.
Please note that this is working on simulator and real devices.
Hope this helps you.

Your code,
activityViewController.excludedActivityTypes = #[UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
Change to this,
activityViewController.excludedActivityTypes = #[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
And if you have to logged into facebook, twitter on your device settings. Then only it will be visible.
Thanks,

Don't include UIActivityTypePostToFacebook in
activityViewController.excludedActivityTypes = #[UIActivityTypePostToTwitter, UIActivityTypePostToWeibo, UIActivityTypeAssignToContact];
[self presentViewController:activityViewController animated:YES completion:nil];

Related

iOS 7 iAd interstitial ads can not be closed by user

when i display interstitial ads with
[interstitial presentFromViewController:self];
i get the warning that this method is deprecated in iOS 7. But it still works fine!
When i display the ad view with
[self requestInterstitialAdPresentation];
[interstitial presentInView:self.view];
i get no warning and the ad is loading but there is no (X) in the ad that the user can close the ad.
Do somebody knows how to fix this?
hey there this is the troublemaker
[interstitial presentInView:self.view];
instead try this (delegate methods) t'should be removed manualy
-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd{
if (interstitial != nil){
_adPlaceholderView = [[UIView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:_adPlaceholderView];
[interstitial presentInView:_adPlaceholderView];
}
and on did unload
- (void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd
{
NSLog(#"ad has been unloaded");
[_adPlaceholderView removeFromSuperview];
_adPlaceholderView = nil;
}
I have the same bug Use the old API or put custom x button .I thinks this is a bug from presentinView . i am not sure it could be apple desired feature there's no documentation on this.At least i haven't seen any.Please share if you find something official on this.

Why does UIImagePickerController NOT sort most recent photos first when using UIImagePickerControllerSourceTypePhotoLibrary?

EDIT: After updating to iOS 7.0.3 the problem is gone
I would like the UIImagePickerController to display photos in a way that the user can access most recent photos first (I am working with iOS7).
I am following this answer https://stackoverflow.com/a/10023924/2007515 , so my function looks like:
- (IBAction)action_album:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
}
But the result is not what I want:
the "Photos" overview is presented (good)
if I pick "Camera Roll" the oldest photos are displayed on top and I have to scroll all the way down to get the most recent ones (not good)
Could someone tell me what I'm missing here? Thank you.
Just figured this out. This seems to be some kind of Apple bug. If your statusbar is hidden when using the UIImagePickerController, the image picker does not automatically scroll to the bottom (newest) and stays at the top (oldest). If I let the status bar show when using the image picker, it auto scrolls to the bottom like it should. Thanks a lot, Apple.

UIActivityViewController not showing "Open in iBooks" option

I have a problem in my app. After getting some statistics, I generate a PDF file, and I want to show an UIActivityViewController with the options "Open in iBooks" and "Send By Mail" mainly (others like "Open in Dropbox" would be great to).
Well the thing is that before trying to use UIActivityViewController, I was using UIDocumentInteractionController, with the following code:
self.docController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.docController.delegate = self;
[_docController presentOpenInMenuFromRect:_openInIBooksButton.bounds inView:self.openInIBooksButton animated:YES];
Where url is a path like /Documents/../statistics.pdf. It worked, it showed a popover with the buttons open in iBooks and open in Dropbox, but not Send by Mail. Now I've changed it with the following code:
NSArray* itemsToShare = [NSArray arrayWithObjects:pdfData, nil];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
activityVC.excludedActivityTypes = #[UIActivityTypeCopyToPasteboard]; //or whichever you don't need
[self presentViewController:activityVC animated:YES completion:nil];
Where pdfData is a NSData object. And it works too, but now it shows the option of sending it by email, but not the iBooks option. I'm going nuts because I don't find the reason of that behavior and I need the two options, iBooks and Mail.
I don't know if it has something to do with the fact that the UIDocumentInteractionController has a path which ends with .pdf and the UIActivityViewController only has a NSData object. But I can't find a solution for that.
Somebody has found that problem before?
Thank you very much.
When you use presentOpenInMenuFromRect:inView:animated: you only get a list of apps that can work with the given file.
What you want to use is presentOptionsMenuFromRect:inView:animated: which gives you the options that you are looking for.

Need to post to facebook and twitter from an ios app

I've been doing some research on how to post to fb and to twitter... I know there is a library called Sharekit and I also know I can post using the new iOS6 feature SLComposeViewController... I just need to post a text, that's all... It's not necessary that the user can edit the message...
I need some advice, what would you use?
If you're ok supporting only iOS6, SLComposeViewController is probably easiest. On the Facebook side, you lose nice little features offered via the Facebook SDK for iOS (e.g., the ability to have the Facebook post bear some indication that it came from your app, the graceful inclusion of both images and URLs, etc.).
Bottom line, if you're ok with iOS6-only and you want to keep it simple, SLComposeViewController is probably easiest and can do both Twitter and Facebook. If you want to make the most of Facebook or if you have to support iOS 5, you really have to pursue the Facebook SDK, but it takes a little more code. On the Twitter side, if you need to support iOS 5, then you need to use TWTweetComposeViewController.
Try this one:
- (IBAction)share:(id)sender
{
NSString *text = #"Your message";
UIImage *image = [UIImage imageNamed:#"yourimage.png"];
NSArray *items = [NSArray arrayWithObjects:text,image , nil];
UIActivityViewController *avc = [[avcClass alloc] initWithActivityItems:items applicationActivities:nil];
avc.excludedActivityTypes = #[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll, UIActivityTypeMessage, UIActivityTypeMail];
[self presentViewController:avc animated:YES completion:nil];
}
This should work for you. Just set the NSString and if you want an image.
No frameworks needed!

Implementing iAd Banner

I just published an application on the App Store with an iAd banner. When I downloaded it to check for the advertisement, I just saw a plain white horizontal rectangle even though it says "Live: This app is receiving live ads." in development.
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
[adView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
[adView setDelegate:self];
[self.view addSubview:adView];
[self.view bringSubviewToFront:adView];
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
return YES;
}
Everything in my performance chart is zero, except for the 715 requests. What does this mean?
Also, is it possible for iAd to determine the user's location so that apple can put ads from local companies? For example, the user is in Japan, will iAd only show ads from Japan?
Does it work in the simulator, i don't think it's a programming error but rather a technical error from apples side. Manny developers is experiencing this:
Can not see iAd in program?
I think there is no ad available so your app receives a nil value. I don't see any check for that, so regardless if it's nil or not, your app tries to display what it got, which may be nil. So you end up with a blank ad with no link what you see there.
I suggest in the next version to check for that and/or use some fallback method like AdMob or something.
You need to check if your ADBannerView received an ad or not and then display or hide it accordingly.
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
// Display banner
adView.alpha = 1.0;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
// Hide banner
adView.alpha = 0.0;
}