0
votes

An app I'm working with uses SLComposeViewController to send Tweets. This functionality has been working in the app for a while. I am running into problems after updating the SDK to 7.0.

The problem is the SLComposeViewController calls its completion handler immediately after presenting. The SLComposeViewControllerResult is Cancel. This happens with any attempt to show the SLComposeViewController.

I was able to get this code working on 64 bit devices/simulator in a sample application, but it fails with the larger application I am working on.

Working cases:

  • Any device with 6.1 SDK
  • Any 32 bit device with 7.0 SDK
  • My sample application

Failing cases:

  • 64 bit iPhone 5S and 64 bit simulator

Here is simple implementation of failing code (pretty much what you can see in any example).

   if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
  {
    SLComposeViewController *vc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];



    [vc setInitialText:@"Hi Twitter"];

    vc.completionHandler = ^(SLComposeViewControllerResult result)
    {

    };

    [self presentViewController:vc animated:YES completion:nil];

    return;
  }

The following article indicates other apps are having trouble sharing via Twitter http://tellmenews.com/ipad-air-suffers-from-same-ios-7-twitter-sharing-problem-as-iphone-5s/179686/samantha-ross. For the record, Twitter sharing from the iOS Photo apps works on my device.

Any ideas of what the differences could be between my working sample app and the failing app?

2

2 Answers

1
votes

Your best bet as a short-term fix is to change your Target > Build Settings > Architectures > Architectures to "Standard Architectures" instead of "Standard Architectures (including 64-bit)".

I suspect this is a bug, and your best option is to submit it to http://bugreport.apple.com. Then, with each future OS update, change your build settings to include 64-bit to see if the issue has been resolved.

1
votes

This is definitely a bug in Apple's frameworks and is known to affect several view controllers including MFMailComposeViewController and TWTweetComposeViewController in addition to SLComposeViewController as noted in this answer: Cannot show modal ViewController in iOS7. It appears to affect 32-bit binaries running on 64-bit devices and can be triggered by a number of different UIAppearance customization calls, but not all of them.

It can be worked around by identifying the specific UIAppearance customization calls in your app that are triggering this behavior and removing those calls on 64-bit devices until you have added 64-bit binary support to your app. Unfortunately this leaves you with the dilemma of how to address the appearance of your app on 64-bit devices without using the UIAppearance customization calls are triggering the bug.

Some UIAppearance calls known to cause this issue are:

[[UILabel appearanceWhenContainedIn:[UIButton class] setShadowOffset:CGSizeMake(0.0, 1.0)];
[[UIBarButtonItem appearance] setTitlePositionAdjustment:UIOffsetMake(0, 1) forBarMetrics:UIBarMetricsDefault];
[[UILabel appearanceWhenContainedIn:[UITableViewHeaderFooterView class], nil] setFont:[UIFont systemFontOfSize:17.0]];