In the main.swift
file, we have a call to our receipt checking system (generated by Receigen). In Swift 2, main.swift
read:
startup(Process.argc, UnsafeMutablePointer<UnsafePointer<Int8>>(Process.unsafeArgv))
After upgrading to Swift 3, I've got as far as:
startup(CommandLine.argc, UnsafeMutablePointer<UnsafePointer<Int8>>(CommandLine.unsafeArgv))
which shows the error:
Cannot convert value of type
UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>
(akaUnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>
) to expected argument typeUnsafeMutablePointer<_>
Update: Using the linked question so that it reads:
startup(CommandLine.argc, UnsafeMutableRawPointer(CommandLine.unsafeArgv)
.bindMemory(
to: UnsafeMutablePointer<Int8>.self,
capacity: Int(CommandLine.argc)))
Produces:
Cannot convert value of type
UnsafeMutablePointer<Int8>.Type
to expected argument typeUnsafePointer<Int8>?.Type
(akaOptional<UnsafePointer<Int8>>.Type
)
Where the compiler is referring to the to:UnsafeMutablePointer
.
The header for startup looks like:
int startup(int argc, const char * argv[]);
How can I successfully pass the variables to startup in main.swift
?