Код: Выделить всё
AudioUnitSetProperty(audioUnit, kMusicDeviceProperty_SoundBankURL, kAudioUnitScope_Global, AudioUnitElement(0), &soundfontURL, UInt32(MemoryLayout.size(ofValue: soundfontURL)))
< /code>
В iOS 26 это вылетает со следующей Backtrace: < /p>
Crashed: com.apple.main-thread
SIGABRT ABORT 0x00000002424200cc
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 268
2 libsystem_c.dylib abort + 124
3 libswiftCore.dylib + 142
4 libswiftCore.dylib + 30
5 libswiftCore.dylib + 142
6 CoreFoundation + 1472
7 CoreFoundation _CF_forwarding_prep_0 + 96
8 CoreFoundation CFURLGetFileSystemRepresentation + 196
9 libEmbeddedSystemAUs.dylib AccessURLAsset(__CFURL const*, int)
10 libEmbeddedSystemAUs.dylib MIDISynth::SetProperty(unsigned int, unsigned int, unsigned int, void const*, unsigned int)
11 libEmbeddedSystemAUs.dylib ausdk::AUBase::DispatchSetProperty(unsigned int, unsigned int, unsigned int, void const*, unsigned int)
12 libEmbeddedSystemAUs.dylib ausdk::AUMethodSetProperty(void*, unsigned int, unsigned int, unsigned int, void const*, unsigned int)
< /code>
xcode показывает следующее предупреждение по этой строке кода: < /p>
Forming 'UnsafeRawPointer' to a variable of type 'URL'; this is likely incorrect because 'URL' may contain an object reference.
Код: Выделить всё
if let urlData = String.toData(soundfontURL.absoluteString) {
urlData.withUnsafeBytes { (u8Ptr: UnsafePointer) in
let urlPointer = UnsafeRawPointer(u8Ptr)
AudioUnitSetProperty(audioUnit, kMusicDeviceProperty_SoundBankURL, kAudioUnitScope_Global, AudioUnitElement(0), urlPointer, UInt32(MemoryLayout.size(ofValue: urlPointer)))
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... for-ios-26