iOS 0.1.2: plugin check can't crash on a stale registration after an update
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7d8311a77f
commit
005e0984de
@@ -3,6 +3,13 @@
|
|||||||
Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in
|
Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in
|
||||||
`../versions.properties` (`ios.versionName` / `ios.versionCode`).
|
`../versions.properties` (`ios.versionName` / `ios.versionCode`).
|
||||||
|
|
||||||
|
## 0.1.2 (build 3)
|
||||||
|
|
||||||
|
- Fix: **Check all plugins** crashed the app right after an update. iOS can still
|
||||||
|
list the old plugin registration while the new one isn't loadable yet, and
|
||||||
|
loading it then raised an exception instead of returning an error. The check
|
||||||
|
now skips such plugins with "not registered (yet)" and catches the exception.
|
||||||
|
|
||||||
## 0.1.1 (build 2)
|
## 0.1.1 (build 2)
|
||||||
|
|
||||||
- Fix: the effects were silent in real hosts (and 0/8 in the app's check). When a
|
- Fix: the effects were silent in real hosts (and 0/8 in the app's check). When a
|
||||||
|
|||||||
@@ -40,6 +40,26 @@ final class PluginCheck: ObservableObject {
|
|||||||
lines.append("\(ok)/\(comps.count) passed")
|
lines.append("\(ok)/\(comps.count) passed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loads a plugin out of process without ever crashing the app. Right after an
|
||||||
|
/// update, iOS may still list the old registration while the new one isn't
|
||||||
|
/// resolvable yet; AVAudioUnit.instantiate then raises an Objective-C
|
||||||
|
/// exception ("comp != NULL") instead of returning an error.
|
||||||
|
private func instantiate(_ desc: AudioComponentDescription) async throws -> AVAudioUnit {
|
||||||
|
var d = desc
|
||||||
|
guard AudioComponentFindNext(nil, &d) != nil else { throw CheckError.notRegistered }
|
||||||
|
return try await withCheckedThrowingContinuation { cont in
|
||||||
|
var resumed = false
|
||||||
|
let ex = SPKTry {
|
||||||
|
AVAudioUnit.instantiate(with: d, options: .loadOutOfProcess) { unit, error in
|
||||||
|
if let unit = unit { cont.resume(returning: unit) }
|
||||||
|
else { cont.resume(throwing: error ?? CheckError.notRegistered) }
|
||||||
|
}
|
||||||
|
resumed = true
|
||||||
|
}
|
||||||
|
if let ex = ex, !resumed { cont.resume(throwing: CheckError.exception(ex)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 1 s at 44.1 kHz stereo: a decaying saw burst, then noise, then silence.
|
/// 1 s at 44.1 kHz stereo: a decaying saw burst, then noise, then silence.
|
||||||
private func testBuffer(format: AVAudioFormat) -> AVAudioPCMBuffer {
|
private func testBuffer(format: AVAudioFormat) -> AVAudioPCMBuffer {
|
||||||
let n = AVAudioFrameCount(format.sampleRate)
|
let n = AVAudioFrameCount(format.sampleRate)
|
||||||
@@ -58,7 +78,7 @@ final class PluginCheck: ObservableObject {
|
|||||||
|
|
||||||
private func check(_ comp: AVAudioUnitComponent) async -> String {
|
private func check(_ comp: AVAudioUnitComponent) async -> String {
|
||||||
do {
|
do {
|
||||||
let unit = try await AVAudioUnit.instantiate(with: comp.audioComponentDescription, options: .loadOutOfProcess)
|
let unit = try await instantiate(comp.audioComponentDescription)
|
||||||
let engine = AVAudioEngine()
|
let engine = AVAudioEngine()
|
||||||
let format = AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 2)!
|
let format = AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 2)!
|
||||||
let player = AVAudioPlayerNode()
|
let player = AVAudioPlayerNode()
|
||||||
@@ -95,3 +115,14 @@ final class PluginCheck: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum CheckError: LocalizedError {
|
||||||
|
case notRegistered
|
||||||
|
case exception(String)
|
||||||
|
var errorDescription: String? {
|
||||||
|
switch self {
|
||||||
|
case .notRegistered: return "not registered (yet): reopen the app, or restart the iPad after an update"
|
||||||
|
case .exception(let e): return "exception \(e)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -17,8 +17,8 @@ android.versionCode = 70
|
|||||||
# iOS/iPadOS (cc.tiredsysadmin.ios.sizzle): the AUv3 plugin app in ios/app; the
|
# iOS/iPadOS (cc.tiredsysadmin.ios.sizzle): the AUv3 plugin app in ios/app; the
|
||||||
# Makefile there passes these to Xcode and names the .ipa by versionCode. (The
|
# Makefile there passes these to Xcode and names the .ipa by versionCode. (The
|
||||||
# TrollStore spike in ios/spike keeps its own version in its project.yml.)
|
# TrollStore spike in ios/spike keeps its own version in its project.yml.)
|
||||||
ios.versionName = 0.1.1
|
ios.versionName = 0.1.2
|
||||||
ios.versionCode = 2
|
ios.versionCode = 3
|
||||||
macos.versionName = -
|
macos.versionName = -
|
||||||
linux.versionName = -
|
linux.versionName = -
|
||||||
bsd.versionName = -
|
bsd.versionName = -
|
||||||
|
|||||||
Reference in New Issue
Block a user