Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.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 无法指定类型为';NSData&x27;设置为类型为';nsuid?&x27;_Ios_Swift_Types_Watch - Fatal编程技术网

Ios 无法指定类型为';NSData&x27;设置为类型为';nsuid?&x27;

Ios 无法指定类型为';NSData&x27;设置为类型为';nsuid?&x27;,ios,swift,types,watch,Ios,Swift,Types,Watch,我试图通过swift使我的pebble watch加载pebble watch应用程序,但出现错误: “无法将“NSData”类型的值分配给“NSUID”类型的值” 以下是我在AppDelegate.swift中的代码: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Overr

我试图通过swift使我的pebble watch加载pebble watch应用程序,但出现错误:

“无法将“NSData”类型的值分配给“NSUID”类型的值”

以下是我在AppDelegate.swift中的代码:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    let pebble = PBPebbleCentral.defaultCentral()
    pebble.delegate = self

    var uuidBytes = Array<UInt8>(count:16, repeatedValue:0)
    let uuid = NSUUID(UUIDString: "MYUUIDiknow")
    uuid?.getUUIDBytes(&uuidBytes)
    pebble.appUUID = NSData(bytes: &uuidBytes, length: uuidBytes.count)

    watch = pebble.lastConnectedWatch()
    return true }
func应用程序(应用程序:UIApplication,didfishlaunchingwithoptions启动选项:[NSObject:AnyObject]?)->Bool{
//应用程序启动后自定义的覆盖点。
让pebble=PBPebbleCentral.defaultCentral()
pebble.delegate=self
var uuidBytes=数组(计数:16,重复值:0)
让uuid=nsuid(UUIDString:“MyuuidKnow”)
uuid?.getUUIDBytes(&uuidBytes)
pebble.appUUID=NSData(字节:&uuidBytes,长度:uuidBytes.count)
watch=pebble.lastConnectedWatch()
返回真值}

任何帮助都将不胜感激。谢谢。

尝试分配
pebble.appUUID=uuid