小编Va *_*sal的帖子

'advancedBy'在Xcode 8中不可用

目前,我一直在使用XCode 8并在线

let range = key.startIndex...key.startIndex.advancedBy(0)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

错误:'advancedBy'不可用:要将索引前进n步,请在生成索引的CharacterView实例上调用'index(_:offsetBy :)'.

我怎样才能解决这个问题?

错误的屏幕截图如下:

advancedBy不可用

ios swift swift3

14
推荐指数
2
解决办法
8743
查看次数

Swift 3(Xcode 8)中不存在canEvaluatePolicy函数中的"switch(error!.code)"

我正在将下面的代码转换为Swift 3.

 if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error:nil) {

  // 2.
  context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics,
    localizedReason: "Logging in with Touch ID",
    reply: { (success : Bool, error : NSError? ) -> Void in

      // 3.
      dispatch_async(dispatch_get_main_queue(), {
        if success {
          self.performSegueWithIdentifier("dismissLogin", sender: self)
        }

        if error != nil {

          var message : NSString
          var showAlert : Bool

          // 4.
          switch(error!.code) {
Run Code Online (Sandbox Code Playgroud)

步骤4在Xcode 8,Swift 3上不再起作用.所以我不能做以下情况:

switch(error!.code) {
          case LAError.AuthenticationFailed.rawValue:
            message = "There was a problem verifying your identity."
            showAlert = true
            break;
Run Code Online (Sandbox Code Playgroud)

目前,似乎还没有我能找到的解决方案.有任何建议,请告诉我.

非常感谢!

error-code ios touch-id swift swift3

0
推荐指数
1
解决办法
2511
查看次数

标签 统计

ios ×2

swift ×2

swift3 ×2

error-code ×1

touch-id ×1