BluetoothManager不工作在iOS 7 [英] BluetoothManager not working on iOS 7

查看:442
本文介绍了BluetoothManager不工作在iOS 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用BluetoothManager在一个应用程序在iOS 7,但它似乎并不奏效。

I'm trying to use BluetoothManager in an app on iOS 7 but it doesn't seem to be working.

调用的setEnabled: setPowered:上BluetoothManager没有任何效果,我报考通知( BluetoothAvailabilityChangedNotification ),但这些都不会发送。

Calling setEnabled: and setPowered: on BluetoothManager doesn't have any effect, and I'm registering for notifications (BluetoothAvailabilityChangedNotification) but these are never sent.

我已经导入了框架,我使用例如code。通过这些问题给出,但这些都是pre-的iOS 7,这可能是问题;

I've imported the framework and I'm using example code as given by these questions, but these are all pre-iOS 7, which may be the problem;

的iOS BluetoothManager Framwork 结果
的iOS:无法获取BluetoothManager工作结果
<一href=\"http://stackoverflow.com/questions/1743610/programmatically-turn-on-bluetooth-in-the-iphone-sdk\">Programmatically打开在iPhone SDK的蓝牙?

推荐答案

原来,这个框架一直没有在iOS中7的保护,仍然可以使用。

Turns out that this framework hasn't been protected in iOS 7 and is still available for use.

我相信这个问题是与BluetoothManager.h和BluetoothDevice.h头文件的位置。他们需要将位于以下目录:
<$c$c>/Applications/X$c$c.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks/BluetoothManager.framework/Headers

I believe the problem was with the location of the BluetoothManager.h and BluetoothDevice.h header files. They need to be located in the following directory: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks/BluetoothManager.framework/Headers

和项目的框架搜索路径构建设置需要包括 $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/ PrivateFrameworks 它使用这些文件。

And the "Framework Search Paths" build setting of your project needs to include $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks for it to use these files.

我不知道为什么这个工作 - (?),具有在X code项目的头文件仍会返回一个有效的对象为 [BluetoothManager sharedInstance] 但根本没有给任何其他功能。至少现在它的工作原理,耶!

I'm not sure why this worked - having the header files in the Xcode project still returned a valid(?) object for [BluetoothManager sharedInstance] but simply didn't give any other functionality. At least now it works, yay!

哦,我应该提到我是如何发现这一点! michaeldorner的BeeTee的GitHub项目是pretty很多专为iOS的7,基本BluetoothManager示例项目自述文件描述了头文件的位置,除此之外,它只是在构建他的项目设置,以使这些头被使用。

Oh and I should mention how I discovered this! michaeldorner's "BeeTee" github project is pretty much a basic BluetoothManager sample project designed for iOS 7. The readme file describes the header file placement, other than that it was just the build setting in his project to enable these headers to be used.

这篇关于BluetoothManager不工作在iOS 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆