简体   繁体   English

无法将不可变值作为inout参数传递:来自&#39;UnsafePointer的隐式转换 <UInt8> ? 到&#39;UnsafePointer <UInt8> ? 需要一个临时的

[英]Cannot pass immutable value as inout argument: implicit conversion from 'UnsafePointer<UInt8>? to 'UnsafePointer<UInt8>?' require a temporary

I have written a method for parsing Receipt of InAppPurchase in Swift2.3 and now I am converting it to Swift3 . 我在Swift2.3编写了一个解析InAppPurchase Receipt的方法,现在我将它转换为Swift3 So I am getting this error. 所以我收到了这个错误。 Anyone has idea, how to fix this? 任何人都有想法,如何解决这个问题?

Swift 3中的收据解析错误

试试这样,

var p: UnsafePointer<UInt8>? = (data as NSData).bytes.bindMemory(to: UInt8.self, capacity: data.count)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM