Uploaded image for project: 'Swift'
  1. Swift
  2. SR-1390

UIApplicationMain has wrong signature

    XMLWordPrintable

    Details

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mattneub Matt Neuburg
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: