iOS Twitterkit Composer SetImage Page jammed on iPhone X

ios

#1

When I was in use TwitterKit share image, I met a page jammed problem on the iPhone X model.

When I share a dynamically generated UIImage object, I use the following code.

This is share the code structure:

 TWTRComposer *composer = [[TWTRComposer alloc] init];
//带图片方法
//[composer setImage:[UIImage imageNamed:@"bg2"]];
[composer setImage:_saveImage];
[composer showFromViewController:self completion:^(TWTRComposerResult result){
    if(result == TWTRComposerResultCancelled) {
        //分享失败
        [MBProgressHUD showError:@"Share Failure!"];
    }else{
        [MBProgressHUD showError:@"Share Successful!"];
    }
}];

This is _saveimage object generated method:

- (UIImage *)captureScrollViewWithView:(UIScrollView *)view withSize:(CGSize)size{
UIImage* image = nil;
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
{
CGPoint savedContentOffset = view.contentOffset;
CGRect savedFrame = view.frame;
view.contentOffset = CGPointZero;
view.frame = CGRectMake(0, 0, view.contentSize.width, view.contentSize.height);

[view.layer renderInContext: UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();

view.contentOffset = savedContentOffset;
view.frame = savedFrame;
}
UIGraphicsEndImageContext();

if (image != nil) {
    return image;
}
return nil;
}

I’m going to put a part of the UIScrollview interception through Twitter share out, but every time sharing on IPhoneX models will appear CPU100 % memory has been the growth of the problem, the page card dead.

But when I use [composer setImage:[UIImage imageNamed: @ "bg2"]]when everything was normal. So I guess it is a problem view to Image method but I don’t understand what problem.

Can you help me?