Ios 无法指定类型为';NSData&x27;设置为类型为';nsuid?&x27;
我试图通过swift使我的pebble watch加载pebble watch应用程序,但出现错误: “无法将“NSData”类型的值分配给“NSUID”类型的值” 以下是我在AppDelegate.swift中的代码: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
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