Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 参数标签';(uuistring)和#x27;不匹配任何可用的重载_Ios_Swift_Xcode_Swift3_Uuid - Fatal编程技术网

Ios 参数标签';(uuistring)和#x27;不匹配任何可用的重载

Ios 参数标签';(uuistring)和#x27;不匹配任何可用的重载,ios,swift,xcode,swift3,uuid,Ios,Swift,Xcode,Swift3,Uuid,我把代码转换成了swift 3。我得到了以下错误: 参数标签“(UUIString)”与任何可用重载都不匹配 有人知道这个错误吗?(我的Xcode版本是8.2)UUID的初始值设定项更改为,因此将参数标签更改为uuistring,返回可选的UUID?实例,因此需要包装可选实例 let region = CLBeaconRegion(proximityUUID: UUID(uuidString: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0")!, identifie

我把代码转换成了swift 3。我得到了以下错误:

参数标签“(UUIString)”与任何可用重载都不匹配


有人知道这个错误吗?(我的Xcode版本是8.2)

UUID的初始值设定项更改为,因此将参数标签更改为
uuistring
,返回可选的
UUID?
实例,因此需要包装可选实例

let region = CLBeaconRegion(proximityUUID: UUID(uuidString: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0")!, identifier: "ru.techmas.techbeacon")
您还可以选择使用
if let
而不是强制包装来展开可选包装

if let uuidStr = UUID(uuidString: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0") {
    let region = CLBeaconRegion(proximityUUID: uuidStr, identifier: "ru.techmas.techbeacon")
}

这类情况的提示:⌘-单击类符号或类型⇧⌘0(零),在搜索字段中键入类名(UUID),并在头文件/文档中查找语法。如果它现在起作用,请接受我的答案,如果您不知道如何接受答案,请检查此链接
if let uuidStr = UUID(uuidString: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0") {
    let region = CLBeaconRegion(proximityUUID: uuidStr, identifier: "ru.techmas.techbeacon")
}