Xcode 8 beta 6:main.swift将无法编译

前端之家收集整理的这篇文章主要介绍了Xcode 8 beta 6:main.swift将无法编译前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们有一个定制的UIApplication对象,所以我们的main. swift
import Foundation
import UIKit

UIApplicationMain(Process.argc,Process.unsafeArgv,NSStringFromClass(MobileUIApplication),NSStringFromClass(AppDelegate))

这在Xcode 8 beta 5中没有起作用,所以我们使用了这一点

//TODO Swift 3 workaround? https://forums.developer.apple.com/thread/46405
UIApplicationMain( Process.argc,UnsafeMutablePointer<UnsafeMutablePointer<CChar>>(Process.unsafeArgv),nil,NSStringFromClass(AppDelegate.self))

在Xcode 8 beta 6上,我们得到使用未解析的标识符’Process’

在Xcode 8 beta 6 / Swift 3中需要做什么来定义UIApplicationMain?

解决方法

我这样写:
UIApplicationMain(
    CommandLine.argc,UnsafeMutableRawPointer(CommandLine.unsafeArgv)
        .bindMemory(
            to: UnsafeMutablePointer<Int8>.self,capacity: Int(CommandLine.argc)),NSStringFromClass(AppDelegate.self)
)

要更改UIApplication类,请在该公式中替换NSStringFromClass(MobileUIApplication.self)为零.

原文链接:https://www.f2er.com/iOS/329974.html

猜你在找的iOS相关文章