当我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.使用时,它按预期工作:
使用时不起作用:
我最初在AudioKit的GitHub问题跟踪器上发布了这个错误.但是,Aure(项目维护者)鼓励我在这里发帖.
我想用 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(...)如果可能,我想避免使用该样式。