我正在使用此代码来评估ios应用程序中的应用程序.
let appLink = "https://itunes.apple.com/us/app/[name of the app]/id[idnumber]?mt=8"
let url = URL(string: appLink)
UIApplication.shared.openURL(url!)
Run Code Online (Sandbox Code Playgroud)
问题是Safari说"页面地址无效"
有没有办法使它工作?我正在使用xcode 9和swift 4
最近我试图查看变量的地址,我有这个问题。
var age: Int = 5
withUnsafePointer(to: age) {
print($0) // 0x00007ffee3362750
print($0.pointee) // 5
}
withUnsafePointer(to: &age) {
print($0) // 0x000000010d226330
print($0.pointee) // 5
}
Run Code Online (Sandbox Code Playgroud)
为什么它显示不同的内存地址以及为什么它显示相同的值pointee?
var strarr = [1, 2]
withUnsafePointer(to: strarr[0]) {
print("\($0)") // 0x00007ffee3362750
print("\($0.pointee)") // 1
}
withUnsafePointer(to: strarr[1]) {
print("\($0)") // 0x00007ffee3362750
print("\($0.pointee)") // 2
}
withUnsafePointer(to: &strarr[0]) {
print("\($0)") // 0x0000600002755760
print("\($0.pointee)") // 1
}
withUnsafePointer(to: &strarr[1]) {
print("\($0)") // 0x0000600002755768
print("\($0.pointee)") // 2
}
Run Code Online (Sandbox Code Playgroud)
对于数组,为什么当我不传递变量的地址时,它为索引 1 和 2 显示相同的内存地址?为什么当我传递内存地址时,它为索引 1 …