-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
| Previous ID | SR-1390 |
| Radar | rdar://26062787 |
| Original Reporter | @mattneub |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Environment
Xcode 7.3, Swift toolchain of April 25 (https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a/swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a-osx.pkg)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 9103fd117383d156f0aeb5a09ed4e03a
Issue Description:
There is still a problem with the signature of UIApplicationMain, and it needs to change. When it does, I presume @UIApplicationMain will have to change with it.
We used to write main.swift by calling UIApplicationMain like this:
UIApplicationMain(
Process.argc, Process.unsafeArgv, nil, NSStringFromClass(AppDelegate)
)
But now that won't compile, because there is a type mismatch between Process.argv, which is typed like this:
UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>
and the second parameter to UIApplicationMain, which is typed like this:
UnsafeMutablePointer<UnsafeMutablePointer<Int8>>!
As you can see, they are subtly different. I am able to work around the problem temporarily by writing this:
withUnsafeMutablePointer(&Process.unsafeArgv.pointee!) {
UIApplicationMain(
Process.argc, $0, nil, NSStringFromClass(AppDelegate)
)
}
But whether that is safe or correct, I have no idea.
It is suggested by Quinn "The Eskimo!" that this problem is a consequence of https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md.