ios - Xamarin/iOS SharedAccessoryManager.ShowBluetoothAccessoryPicker 失败

标签 ios xamarin xamarin.ios external-accessory

我正在为我的项目将工作 Swift 代码移植到 Xamarin。每次我调用此函数时,它都会失败,并且不会显示附件选择器对话框。

EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker(谓词,完成)

以下是我已经确认的一些事情:

赛马林:

        EAAccessoryManager.SharedAccessoryManager.ShowBluetoothAccessoryPicker(null, completion: ((Foundation.NSError error) => {
            Console.WriteLine("My callback");   
            if (error != null) {
                Console.WriteLine(String.Format("Error code: {0} Desc: {1}", error.Code, error.DebugDescription));
                Console.WriteLine("Failed? " + EABluetoothAccessoryPickerError.Failed.ToString());
                Console.WriteLine("Failed? " + Convert.ToInt64(EABluetoothAccessoryPickerError.Failed));
            }
        }));

Xcode/ swift :

        EAAccessoryManager.sharedAccessoryManager().showBluetoothAccessoryPickerWithNameFilter(nil) { (error) -> Void in
        if error != nil {
            NSLog("Error code: \(error!.code) \(error.debugDescription)")
        }
    }

Xamarin 代码不显示选取器,并且总是会失败。

2016-04-05 19:54:02.136 ASGDemo.iOS[6383:2146384] Connect Clicked
2016-04-05 19:54:06.139 ASGDemo.iOS[6383:2146384] BTM: attaching to BTServer
2016-04-05 19:54:09.157 ASGDemo.iOS[6383:2146384] BTM: session attach called back with BT_SESSION_ATTACHED (fffffed0)
2016-04-05 19:54:09.158 ASGDemo.iOS[6383:2146384] BTM: attemping to re-attach in 1 seconds
2016-04-05 19:54:09.242 ASGDemo.iOS[6383:2146384] My callback
2016-04-05 19:54:09.250 ASGDemo.iOS[6383:2146384] Error code: 3 Desc: Error Domain=EABluetoothAccessoryPickerErrorDomain Code=3 "(null)"
2016-04-05 19:54:09.253 ASGDemo.iOS[6383:2146384] Failed? Failed
2016-04-05 19:54:09.254 ASGDemo.iOS[6383:2146384] Failed? 3

最佳答案

Xamarin 的好心人直接帮助了我,所以我在这里发布了解决方案。他们说这是一个已经修复的错误。该更新应在本月晚些时候通过自动更新发布(如果您启用了自动更新)。

目前,他们提供了一种变通方法,我已经验证该变通方法对我和我的项目同事都有效。以下是解决方法的步骤:

  1. 清理项目
  2. 在 iOS-Build 部分下的项目选项中取消选中启用特定于设备的构建
  3. 从设备中删除旧应用
  4. 现在,重建/重新部署,它应该可以工作了。

感谢大家的建议和帮助。另外,感谢 Xamarin 的人员及时做出响应。

关于ios - Xamarin/iOS SharedAccessoryManager.ShowBluetoothAccessoryPicker 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36441071/

相关文章:

android - 我的 ImageView 没有出现在我的设备屏幕上

ios - UITableView 方法的异常行为 "indexPathForRowAtPoint:"

ios - AVPlayer - 检索所有格式的音轨

ios - TestFlight App 显示错误的 SDK 版本

c# - 如何使用 Skia 或 SkiaSharp 绘制富文本

Xamarin 表单(android 项目)使用 Skia 图形库渲染图像时出错

xamarin.ios - Xamarin与跨平台webservice访问+json解析

ios - 如何在 DialogViewController (Monotouch.Dialog) 上设置背景颜色

c# - 根级别的数据无效。第 1 行,位置 1 MonoTouch

IOS HockeyApp 崩溃日志 |应用程序没有完全终止,但没有发生崩溃