标签: xcode9-beta

无法在xcode 9 beta中创建新的模拟器

我刚刚安装了xcode 9.0 beta.我正在尝试创建一个新的模拟器,但是当我单击"创建"按钮(下图)时它没有响应.任何的想法?

在此输入图像描述

ios11 xcode9-beta

6
推荐指数
1
解决办法
2714
查看次数

如何在 CoreML 中初始化 MLMultiArray

我有一个由 40 个数组组成的数组,其中包含 12 个双重特征,所以类型是 [[double]]。目前我正在将此数据发送到 Google Cloud ML API 以获得相关预测。

由于 Apple 最近推出了 CoreML 和 coremltools,我将我的模型从 keras 转换为 .mlmodel 以避免数千次 google cloud api 调用并直接在我的 iPhone 上进行推理:

coreml_model = coremltools.converters.keras.convert(new_Model, input_names=['accelerations'],
                                                    output_names=['scores'])
coreml_model.save('PredictionModel.mlmodel')
Run Code Online (Sandbox Code Playgroud)

将模型添加到我的 Xcode 项目后,它看起来像: 在此处输入图片说明

我不知道这些其他输入和输出来自哪里。要获得预测,我需要将我的 12 个双精度数组数组转换为 MLMultiArray,但我不知道如何执行此操作。有没有人遇到过类似的问题?这是我目前未完成的方法:

_predictionModel = PredictionModel()
guard let mlMultiArray = try? MLMultiArray(dataPointer: <#T##UnsafeMutableRawPointer#>, shape: <#T##[NSNumber]#>, dataType: <#T##MLMultiArrayDataType#>, strides: <#T##[NSNumber]#>, deallocator: <#T##((UnsafeMutableRawPointer) -> Void)?##((UnsafeMutableRawPointer) -> Void)?##(UnsafeMutableRawPointer) -> Void#>) else {
        fatalError("Unexpected runtime error.")
    }
guard let predictionOutput = try? _predictionModel.prediction(accelerations: mlMultiArray, lstm_1_h_in: nil, lstm_1_c_in: …
Run Code Online (Sandbox Code Playgroud)

swift ios11 xcode9-beta coreml xcode9

6
推荐指数
1
解决办法
8844
查看次数

安装占位符时无法获取终止声明.这是什么意思?

我在Xcode 9 beta中收到此错误.这是什么意思?附加相同的快照.在此输入图像描述

xcode9-beta

6
推荐指数
1
解决办法
1528
查看次数

初始化MPVolumeView会导致iOS 11 beta 3上的应用程序崩溃

从iOS 11的第3版开始,我的应用程序在初始化用于AirPlay的MPVolumeView时开始崩溃.以下代码在早期版本的iOS和iOS 11 beta 1和2上运行得非常好.

func setupAirplayButton() {
    let rect = CGRect(x: -1000, y: -1000, width: 10, height: 10)
    volumeView = MPVolumeView(frame: rect) //app crashes here
    volumeView.showsVolumeSlider = false
    volumeView.setRouteButtonImage(nil, for: .normal)
    volumeView.translatesAutoresizingMaskIntoConstraints = false
    volumeView.isHidden = true

    if let airplayButton = volumeView.subviews.filter({$0 is UIButton }).first as? UIButton {
        self.airplayButton = airplayButton
        self.airplayButton?.addObserver(self, forKeyPath: "alpha", options: [.initial, .new], context: nil)
    }

    NotificationCenter.default.addObserver(self, selector: #selector(wirelessRouteActiveChanged), name: NSNotification.Name.MPVolumeViewWirelessRouteActiveDidChange, object: nil)

    myView.addSubview(volumeView)
}
Run Code Online (Sandbox Code Playgroud)

还有其他人遇到过同样的问题吗?

编辑:

崩溃日志

Exception Type:  EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, …
Run Code Online (Sandbox Code Playgroud)

ios airplay mpvolumeview ios11 xcode9-beta

6
推荐指数
1
解决办法
1062
查看次数

Xcode 9不会通过变量名自动完成功能

我们都知道并喜欢Xcode的自动完成功能. 在此输入图像描述 上面的截图来自Xcode 9.我看起来与Xcode 8中的相同.它了解我的类,以及它的所有不同的声明和功能等.这不是SearchPaths问题.

Xcode 8中,我们能够开始键入函数名称或任何函数/初始化器声明中使用的任何变量的名称,以帮助我们想要的自动完成单个输出,如下所示: 在此输入图像描述

但是,在Xcode 9中,这种情况不再发生.相反,它完全忽略上下文并开始显示自动完成,就像我在新行上键入它一样. 在此输入图像描述 有没有办法再次启用它?直到我失去它,我才知道我需要这个功能.

xcode autocomplete ios xcode9-beta xcode9

6
推荐指数
1
解决办法
1129
查看次数

Xcode 9:块压缩的有效负载操作失败

MacBook Pro El Capitan(10.11.6)在这里.我正在尝试安装Xcode 9,以便我可以使用ARKit.在Apple Developer的网站上,我能找到的唯一版本是9 Xcode_9_beta_6.xip(如果我错了请纠正我!),所以我下载它:

在此输入图像描述

然后我提取并运行XIP文件:

在此输入图像描述

但是由于这个奇怪的错误谷歌并没有真正帮助我(根本),这个操作失败了:

在此输入图像描述

有什么想法在这里发生了什么?

macos xcode ios xcode9-beta

6
推荐指数
1
解决办法
2045
查看次数

如何将SCNAnimationPlayer"裁剪"为特定的开始和结束时间,iOS 11

我有一个带有长动画的.dae模型.动画包括步行,跑步,击球,死亡等部分.我知道每个部分的开始和结束的帧数.我也知道每秒帧速率.因此,获取每个细分的开始和结束时间非常简单.

我可以将完整的动画作为SCNAnimationPlayer对象.我一直在尝试的是制作完整动画的副本,然后设置动画的timeOffset和持续时间.

let walkPlayer = fullPlayer.copy() as! SCNAnimationPlayer
walkPlayer.stop()
walkPlayer.animation.timeOffset = walk.offset
walkPlayer.animation.duration = walk.duration
Run Code Online (Sandbox Code Playgroud)

然后我将walkPlayer添加回Bip01节点(我从中获得了完整的动画).

我可以通过调用animationPlayer(forKey:"walk")来轻松地完成游戏.?play()

我可以很容易地改变动画的持续时间和其他方面.但是动画总是从第0帧开始.无论我放入什么值.timeOffset,它都会被忽略.

如何从SCNAnimationPlayer中的SCNAnimation的起始帧到结束帧进行播放?

animation scenekit ios11 xcode9-beta arkit

6
推荐指数
1
解决办法
903
查看次数

如何解决 [CoreBluetooth] API MISUSE: 只能在 swift 4 的开机状态下接受此命令?

我创建了一个 iOS 应用程序来搜索最近的蓝牙设备。但是当我在 iPhone 上运行这个应用程序时,出现以下错误

[CoreBluetooth] API MISUSE:只能在开机状态下接受此命令

我该如何解决此错误?为什么应用程序中会出现此错误?提前致谢

func centralManagerDidUpdateState(_ central: CBCentralManager) {
    print(central.state)
    switch (central.state) {
    case CBManagerState.poweredOff:
       print("CoreBluetooth BLE hardware is powered off")
        break;
    case CBManagerState.unauthorized:
        print("CoreBluetooth BLE state is unauthorized")
        break

    case CBManagerState.unknown:
         print("CoreBluetooth BLE state is unknown");
        break

    case CBManagerState.poweredOn:
        print("CoreBluetooth BLE hardware is powered on and ready")
        bluetoothAvailable = true;
        break;

    case CBManagerState.resetting:
         print("CoreBluetooth BLE hardware is resetting")
        break;
    case CBManagerState.unsupported:
          print("CoreBluetooth BLE hardware is unsupported on this platform");
        break
    }
    if bluetoothAvailable == …
Run Code Online (Sandbox Code Playgroud)

xcode core-bluetooth swift swift3 xcode9-beta

6
推荐指数
0
解决办法
7668
查看次数

在Swift 4中设置textView.typingAttributes前景色

我正在使用下面的方法在Swift 3中将textView.typingAttributes前景色设置为红色.

textView.typingAttributes[NSForegroundColorAttributeName] = UIColor.red
Run Code Online (Sandbox Code Playgroud)

现在,我已经向Swift 4迁移了它的显示错误,我尝试如下,但它仍然显示错误.什么是正确的设置方式?

textView.typingAttributes[NSAttributedStringKey.foregroundColor] = UIColor.red
Run Code Online (Sandbox Code Playgroud)

uitextview nsattributedstring ios swift4 xcode9-beta

5
推荐指数
1
解决办法
1516
查看次数

iOS 11 - 始终打开照片库,即使源类型也从.photoLibrary更改为.camera

该代码在iOS 10及更低版本中完美运行.但是,在iOS 11取消照片库并打开相机后,它总是打开照片库.这只发生在iOS 11中.

代码在Xcode 9 Beta 4中编译.

代码如下:

@IBAction func buttonProfilePicPressed(_ sender: UIButton)
{
    let alert = UIAlertController(title: "Choose Image", message: nil, preferredStyle: .actionSheet)
    alert.addAction(UIAlertAction(title: "Camera", style: .default, handler: { _ in
        self.openCamera()
    }))

    alert.addAction(UIAlertAction(title: "Gallery", style: .default, handler: { _ in
        self.openGallary()
    }))

    alert.addAction(UIAlertAction.init(title: "Cancel", style: .cancel, handler: nil))

    self.present(alert, animated: true, completion: nil)
    imgPicker.delegate = self
    self.present(imgPicker, animated: true, completion: nil)
}

func openCamera()
{
    if(UIImagePickerController .isSourceTypeAvailable(UIImagePickerControllerSourceType.camera))
    {
        imgPicker.sourceType = UIImagePickerControllerSourceType.camera
        imgPicker.allowsEditing = true
        self.present(imgPicker, …
Run Code Online (Sandbox Code Playgroud)

uiimagepickercontroller ios11 xcode9-beta

5
推荐指数
2
解决办法
1972
查看次数