这是一个粗略的例子:
class AppDelegate: UIResponder,UIApplicationDelegate { let tracker = AKMicrophoneTracker() func application(_ application: UIApplication,dIDFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // start the tracker and show frequency information tracker.start() Timer.scheduledTimer(withTimeInterval: 0.1,repeats: true,block: { _ in print(tracker.frequency) print(tracker.amplitude) }) }}
我重置了物理设备的隐私权限,iOS正确地提示我允许麦克风访问.即使我允许麦克风访问,它仍然无法正常工作.
如何让AKMicrophoneTracker实际读取这些值?
我正在使用AudioKit 4.0.3.使用时,它按预期工作:
>我的Mac上的AudioKit游乐场
>运行iOS 11.1的模拟器iPhone 7 Plus
使用时不起作用:
>运行iOS 11.1.1的物理iPhone 7 Plus(也适用于iOS 11.1)
我最初发布的是a bug on AudioKit’s GitHub issue tracker.但是,Aure(项目维护者)鼓励我在这里发帖.
解决方法 以下是7,6s为我工作的:在AppDelegate中:
import UIKitimport AudioKit@UIApplicationMainclass AppDelegate: UIResponder,UIApplicationDelegate {var window: UIWindow?let tracker = AKMicrophoneTracker()func application(_ application: UIApplication,dIDFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // OverrIDe point for customization after application launch. // start the tracker and show frequency information tracker.start() Timer.scheduledTimer(withTimeInterval: 0.5,block: { _ in print(self.tracker.frequency) print(self.tracker.amplitude) }) return true}...
info.pList中
...<key>NSMicrophoneUsageDescription</key><string>WE need your microfone to contact the alIEns</string>...总结
以上是内存溢出为你收集整理的为什么AudioKit的AKMicrophoneTracker不能在物理iOS设备上运行?全部内容,希望文章能够帮你解决为什么AudioKit的AKMicrophoneTracker不能在物理iOS设备上运行?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)