How to add an app icon to the IOS native share? - ios

I added the ability to share information from my app, but the native share menu presents this white default icon next to the "text to share" instead of my app icon.
This is the code I used to show the share window -
NSString* nsTitle = UTF8_TO_PSTR(title);
NSArray* activities = #[nsTitle];
UIActivityViewController* sharingController = [[UIActivityViewController alloc] initWithActivityItems:activities applicationActivities:nil];
[navigationController presentViewController:sharingController animated:YES completion:nil];
How can I add my app icon to the share window?
I already have some icons in the AppIcon.appiconset folder, but it doesn't use them.

Related

Why does iMessages change the URL I pass to it via the UIActivityViewController?

my code is very simple, but there's a bug somewhere and I can't seem to figure this out.
Step 1:
// create an array that contains this url
NSArray *items = #[[NSURL URLWithString:#"https://danzafuerte33.as.me/YogaPrivate"]];
UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
[self.window.rootViewController presentViewController:shareController animated:true completion:nil];
Step 2:
The activity view controller modal will show up, and one of the choices will be iMessages.
Step 3:
Tap on iMessages -- notice that the correct url is shared -- so far so good
Step 4:
Tap cancel on the iMessages modal window, the UIActivityViewController should still be visible
Step 5:
Tap on iMessages again, the url is changed to https://app.acuityscheduling.com/schedule.php?owner=12808744 which is not the right url!
Why on earth is this happening the second time iMessages opens this link, is this an iMessages bug?
When the url is passed to iMessages, it retrieves the web site in order to render a preview.
At the top of the page returned is:
<link rel="canonical" href="https://app.acuityscheduling.com/schedule.php?owner=12808744">
This says that the canonical link for this page is https://app.acuityscheduling.com/schedule.php?owner=12808744, and so the activity item is updated with this, preferred, url for the page.

Pinterest iOS sharing extension stuck on "Pick Image..."

I'm working on an iOS app which has a "Share with..." option. This share with option presents a UIActivityViewController to the user. When the user picks the "Pinterest" button, a new view controller is shown (the Printerest share extension view controller) and then gets stuck on the "Pick Image..." screen (screenshot attached). I'm not sure what the problem is since the same code works for all other extensions I've seen.
Here's the code:
UIImage* image = <image here>;
NSURL* url = <image url here>;
UIActivityViewController* vc = [[UIActivityViewController alloc] initWithActivityItems:#[ image, url ] applicationActivities:nil];
[self presentViewController:vc animated:YES completion:nil];
Any ideas what I'm doing wrong. Is this a Pinterest issue or is it my issue?
I tested your code with this question url and it is working fine:
pinterest code test image
You have to check your url and your image is not nil and be sure to configure your pinterest app in your device.

iOS 8 - Disable iCloud Photo Sharing Activity

Apparently iOS8 by default adds a "iCloud Photo Sharing" activity to activity views in iOS8 and I haven't found any useful documentation regarding it, especially how to explicitly remove it (going into the "More" option allows the user to toggle showing/hiding it, but for our app we want to completely disallow this option).
Has anyone figured anything out about how to disable this? Any input would be appreciated. Thanks!
If you init your UIActivityViewController with full of images, iCloud sharing set to activity types by default. You can add a string in your activityItems array. This move will cause that iCloud sharing to be removed from activityTypes.
NSArray *Items = [NSArray arrayWithObjects: image1, image2, #"", nil];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:Items applicationActivities:nil];
Normally you'd set the excludedActivityTypes property on your UIActivityViewController instance -- e.g., to exclude posting to Facebook, you'd put UIActivityTypePostToFacebook in that array.
But it doesn't look like the Built-in Activity Types list (either in the documentation or in UIActiviy.h) includes a constant for iCloud Photos. That's probably worth filing a bug about.

UIActivityViewController with ugly header

I use a UIActivityViewController with valid activities in the activityItems (NSArray).
UIActivityViewController* activityController=[[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
I have a problem with the appearance of the UIActivityViewController both in the simulator and on the iPhone itself. If I click 'Mail' then a mail form pops up that displays its title 'New message' directly over the statusbar (can't show you a picture 'cause I lack 'reputation'?) ending up with text written over info in the status bar.
The same happens with the message-activity. I think that the things I do are pretty basic and don't even offer the opportunity to mess things up. So what can be the reason that this happens? Or better: how can I prevent this from happening?
(Screenshot of the problem.)
Simple solution what worked for me is to embed view in Navigation Controller.
If you are using Storyboard you can try this.

Using Apple icons with iOS 6

With the release of iOS 6 I'd like to revisit the original question here: Access to Apple's built in Icons?
For example, when you hit the 'action' button to share a photo, now instead of an action sheet with buttons titled 'Message', 'Mail', etc., now there is a collection view of the icons for mail, messaging, facebook, twitter, etc.
For a 'share' action in my app I'd like to be able to present the same - because it looks better and would provide a consistent user experience. Is the use of these icons still not allowed, even if they are referring to (and would take the user to) the apps they originally belong to?
For just showing the share UI with icons, you probably want UIActivityViewController.
NSString* someText = self.textView.text;
NSArray* dataToShare = #[someText]; // ...or whatever pieces of data you want to share.
UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataToShare
applicationActivities:nil];
[self presentViewController:activityViewController animated:YES completion:^{}];
It looks like:
Documentation here.
The problem with using UIActivity for sending mail is that you cannot set the subject field's text, recipients, etc. like you can with MFMailComposeViewController
I've been trying to do a workaround to set the subject field, but have not found a solution yet.
UIActivity class provides built-in activity types for mail, messaging, ...

Resources