iOS 11 和 Objective-C 警告在 SWIFT 4.0 中导入

iOS 11 and Objective-C warning imported in SWIFT 4.0

应用程序在通过桥接更新到 SWIFT 4.0 之前没有问题-Header.h 现在我通过:SWIFT 4.0导入Objective-C的文件有错误; xCode 9.1。

我在这里问与大多数人类似的问题的唯一原因 - 所有其他答案都是关于 SWIFT。此错误在 OBJECTIVE-C 文件中。这不是关键,程序运行良好,但如何修复错误(不是隐藏)。

#pragma mark Containment view controller deployment and transition

// Containment Deploy method. Returns a block to be invoked at the
// animation completion, or right after return in case of non-animated deployment.
- (void (^)(void))_deployForViewController:(UIViewController*)controller inView:(UIView*)view
{
    if ( !controller || !view )
        return ^(void){};

    CGRect frame = view.bounds;

    UIView *controllerView = controller.view;
    controllerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    controllerView.frame = frame;

    if ( [controllerView isKindOfClass:[UIScrollView class]] )
    {
        BOOL adjust = controller.automaticallyAdjustsScrollViewInsets;

        if ( adjust )
        {
            [(id)controllerView setContentInset:UIEdgeInsetsMake(statusBarAdjustment(_contentView), 0, 0, 0)];
        }
    }

    [view addSubview:controllerView];

    void (^completionBlock)(void) = ^(void)
    {
        // nothing to do on completion at this stage
    };

    return completionBlock;
}

这与Swift无关。

如错误消息所述,UIViewController 属性 automaticallyAdjustsScrollViewInsets 已在 iOS 11 中弃用。改用 UIScrollView 的 contentInsetAdjustmentBehavior