小编Joh*_*ore的帖子

为什么AudioKit的AKMicrophoneTracker不能在物理iOS设备上运行?

当我AKMicrophoneTracker在物理设备上使用AudioKit时,频率和幅度始终都是0.但是在游乐场和iOS模拟器中,它完美运行.

这是一个粗略的例子:

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)
        })
    }

}
Run Code Online (Sandbox Code Playgroud)

我重置了物理设备的隐私权限,iOS正确地提示我允许麦克风访问.即使我允许麦克风访问,它仍然无法正常工作.

如何让AKMicrophoneTracker实际读取这些值?

我正在使用AudioKit 4.0.3.使用时,它按预期工作:

  • Mac上的AudioKit游乐场
  • 运行iOS 11.1的模拟器iPhone 7 Plus

使用时不起作用:

  • 运行iOS 11.1.1的物理iPhone 7 Plus(也适用于iOS 11.1)

我最初在AudioKit的GitHub问题跟踪器上发布了这个错误.但是,Aure(项目维护者)鼓励我在这里发帖.

ios swift audiokit

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

如何在没有 where 条件的情况下批量更新 Eloquent 模型?

我想用 Eloquent 模型的新值更新表中的所有行。Laravel 的文档给出了以下使用 Eloquent 进行大规模更新的示例:

App\Flight::where('active', 1)
          ->where('destination', 'San Diego')
          ->update(['delayed' => 1]);
Run Code Online (Sandbox Code Playgroud)

但我不需要 where 条件。理想情况下,我将能够运行这样的事情:

App\Flight::update(['delayed' => 1]);
Run Code Online (Sandbox Code Playgroud)

其中省略了where子句。但这给出了错误:

PHP Deprecated:  Non-static method Illuminate\Database\Eloquent\Model::update() should not be called statically on line 1
Run Code Online (Sandbox Code Playgroud)

如何使用 Eloquent 批量更新表中的所有行?DB::table('flights')->update(...)如果可能,我想避免使用该样式。

php laravel eloquent

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

标签 统计

audiokit ×1

eloquent ×1

ios ×1

laravel ×1

php ×1

swift ×1