Problem in using TWTRComposerViewController, iPhoneX(iOS11.x)


#1

Hello:

I am working on sending tweets with an attachment, especially using a saved screenshot(.png).
I use TWTRComposerViewController and do the same as this document said.

- (void)composeTweet:(NSString*)text imgPath:(NSString*)imgPath;
{
    UIViewController* vc = GetViewController();
    UIImage* img = (imgPath == nil ? nil : [UIImage imageWithContentsOfFile:imgPath]);
    TWTRComposerViewController* composer = [TWTRComposerViewController emptyComposer];
    [composer initWithInitialText:text image:img videoURL:nil];
    composer.delegate = self;
    [vc presentViewController:composer animated:YES completion:nil];
}

It works prefect on iPhone7(11.0), but fails on iPhoneX(11.0.1 / 11.2.2).
On iPhoneX(11.0.1 / 11.2.2), the ViewController will never show up, and all the UI are frozen.
If I change the code like this, it will be fine.

    [composer initWithInitialText:text image:nil videoURL:nil];

On the other hand, I can find that the memory is keep leaking at about 2MB / sec.

Any knowledge on this issue would be appreciated.


#3

I’m also seeing this issue, it appears to happen with random images (some work, some don’t). Trying to nail down what the issue is with the images now.


#4

Thanks for the reply.

In my case, I got 100% freeze in iPhoneX even if I changed some much smaller png(16 x 16), but iPhone7 just works fine.
Also I tried to find out how the view-controller-layers will be looked like, by using “Debug View Hierarchy” in the Xcode. And then my Xcode got frozen.


#5

For what it’s worth, I wasn’t able to pin down what caused the images to not work. It wasn’t alpha channel or file type, and didn’t appear to have anything to do with file size or pixel size. Some seemingly random .pngs worked, while others caused a freeze.


#6

Thanks, ruddct.
So far, I still can not find a worked png for my iPhoneX.:disappointed_relieved:


#7

If I do something like this:

    TWTRComposerViewController* composer = [TWTRComposerViewController emptyComposer];
    CGFloat w = composer.view.frame.size.width;
    CGFloat h = composer.view.frame.size.height;
    [composer initWithInitialText:text image:img videoURL:nil];

I will get a frozen TWTRComposerViewController with “What’s happening?” as a default message. And also a alert dialog which says “No Twitter Account There are no Twitter accounts configured. You can create or log in to an account in the Twitter app”.
So I took a screenshot by using “Debug View Hierarchy” :

and those weird logs

2018-01-16 14:26:04.256786+0900 [775:330349] [LayoutConstraints] View has an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*UITableView:0x11f078000- AMBIGUOUS LAYOUT for UITableView:0x11f078000.minY{id: 410}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
2018-01-16 14:26:04.276446+0900 [775:330349] [LayoutConstraints] View has an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*TSETweetTextViewContainer:0x11df0c460- AMBIGUOUS LAYOUT for TSETweetTextViewContainer:0x11df0c460.Height{id: 362}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
2018-01-16 14:26:04.286287+0900 [775:330349] [LayoutConstraints] View has an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*UIScrollView:0x11e82bc00- AMBIGUOUS LAYOUT for UIScrollView:0x11e82bc00.contentHeight{id: 918}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
2018-01-16 14:26:04.396249+0900 [775:330349] [LayoutConstraints] View has an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*UIView:0x12020ce30- AMBIGUOUS LAYOUT for UIView:0x12020ce30.minX{id: 622}, UIView:0x12020ce30.minY{id: 904}, UIView:0x12020ce30.Width{id: 527}, UIView:0x12020ce30.Height{id: 905}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
2018-01-16 14:26:04.397875+0900 [775:330349] [LayoutConstraints] View has an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*UIView:0x120211160- AMBIGUOUS LAYOUT for UIView:0x120211160.minY{id: 903}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host
2018-01-16 14:26:04.472152+0900 [775:330349] [LayoutConstraints] Window has a view with an ambiguous layout. See "Auto Layout Guide: Ambiguous Layouts" for help debugging. Displaying synopsis from invoking -[UIView _autolayoutTrace] to provide additional detail.
*UIScrollView:0x11e82bc00- AMBIGUOUS LAYOUT for UIScrollView:0x11e82bc00.contentHeight{id: 918}
Legend:
    * - is laid out with auto layout
    + - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
    • - layout engine host

#8

Hello :

did you find any solution for this? Because i’m also facing this issue in iPhone-x when i present TWTRComposerViewController with video url.Please give me some hint.


#9

Hi, brstdev

Sorry to tell you, I have no idea how to fix it.
Did you try something like uploading png, BTW.


#10

Hello xuxKyo,

I’m uploading video as given below,

TWTRComposerViewController *composer = [[TWTRComposerViewController emptyComposer] initWithInitialText:@“Testing” image:nil videoURL:url];
composer.delegate = self;

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

The composer present on iPhone-x, if i give video url as nil.


#11

Hi, brstdev

I tried this, too. And it works fine on iPhoneX.

But, I realized that your problem maybe not the same as mine.
Check this

It seems that you need a preview for your video.
In my case, I just want to upload a picture.


#12

I met the same problem, can you tell me you solved?


#13

Hi bailangA,
Sorry to tell you, I could’t find a solution to this issue.