Facebook image order - ios

I was trying to use the post to facebook using an UIActivityViewController. I did set the data array and everything works fine but there is a issue with the image order. The images I post to facebook does not preserve the order of the image array I gave to the UIActivityViewController. The posting order seems to be random. Is there any way to post these pictures to facebook with the given order.
Appreciate your help.
code i use:UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:_imagesToShare
applicationActivities:nil];
[self presentViewController:controller animated:YES completion:nil];
_imagesToShare is the array with the image and caption objects.

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.

SLComposeViewController setInitialText not showing up in View

I'm trying to use the SLComposeViewController to share a link in my iOS App.
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:#"Here's the link I promised:"];
[controller addURL:[NSURL URLWithString:#"http://www.url.com"]];
[self presentViewController:controller animated:YES completion:nil];
When the controller presents, there is no text in the entry box. You can add text and send it fine (the URL shows up correctly in the Post as well).
I just installed FacebookSDK 4.01 and it's a iOS 7/8 App.
Any ideas on why the initial text isn't showing up. I even tried to do it without the URL and just do text, but nothing.
Additional Note: If I do remove the addURL, then the App freezes when I touch "Post" and the post never gets sent.
Thanks for any help!!!
I found a nice way to work around this which still gives the user control.
For Facebook only, just before presenting the SLComposerViewController I show a self dismissing alert (with a 6 second dismissal if OK wasn't tapped). This alert will contain "Write to your friends about how you did playing !\n\nYou can just PASTE for a preset message.".
Right after showing the alert, I then use the following to post a preset message to the UIPasteboard:
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = msg;
So then the SLComposeViewController is presented and an alert view right over it. Once the user dismisses the alert view (or 6 seconds passes and it self dismisses), that the user has the option to just PASTE, right in the message text, your preset message. Or not, that's the beauty of it.
Hope this helps some others get around what FB decided to suddenly enforce. I didn't even realize it was against policy to use the setInitialText method for FB.
Cheers.
This behaviour is intended. See also this bug report: https://developers.facebook.com/bugs/962985360399542/. As #WizKid mentions, it's against policy to pre-fill text. Up until recently, you could still do so (violating the policy) but now this is actually enforced.
There is nothing you can do for this on your side; it's a policy enforcement by Facebook.
Also, related Rdar: http://openradar.appspot.com/20709403

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