Hello!
We have a cross-platform plugin.
With an host we can save the state on iPadOS and restore it on macOS, but when RestoreState is called it return before call setStateInformation
if (err != noErr)
return err;
because err
is equal to -10851 (kAudioUnitErr_InvalidPropertyValue).
We have checked the plist with the saved state and We noticed that the “version” tag is different:
for iPad is 1
for macOS is 0
So the problem is on this check:
// first step -> check the saved version in the data ref
// at this point we're only dealing with version==0
CFNumberRef cfnum = reinterpret_cast<CFNumberRef>(CFDictionaryGetValue (dict, kVersionString));
if (cfnum == NULL) return kAudioUnitErr_InvalidPropertyValue;
SInt32 value;
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
if (value != kCurrentSavedStateVersion) return kAudioUnitErr_InvalidPropertyValue;
I’m asking why the #define kCurrentSavedStateVersion
is set to 0
Vice versa saving from macOS and restore on iPadOS is working.
I can solve this problem setting kCurrentSavedStateVersion to 1.