Prerequisites
- A working iOS quickstart
- An active effect package that declares runtime parameters
Read the authored controls
Query parameters only after the package apply completion succeeds:
NSArray<NSDictionary *> *parameters =
[[NosmaiSDK sharedInstance] getEffectParameters] ?: @[];
for (NSDictionary *parameter in parameters) {
NSLog(@"%@ (%@): %@", parameter[@"displayName"],
parameter[@"type"], parameter[@"currentValue"]);
}
Each dictionary can include name, type, displayName, description, currentValue, defaultValue, hasRange, minValue, maxValue, and options. Treat name as an opaque package contract.
Update a value
Use the parameter's declared type. Replace the placeholder with a name returned by getEffectParameters for the active package:
BOOL updated = [[NosmaiSDK sharedInstance]
setEffectParameter:@"AUTHORED_PARAMETER_NAME"
value:0.5f];
BOOL textUpdated = [[NosmaiSDK sharedInstance]
setEffectParameter:@"AUTHORED_TEXT_PARAMETER_NAME"
stringValue:@"Hello"];
Clamp numeric values to the declared range when hasRange is true. A NO result means the active package did not accept that name, type, or value.
Verify the update
Read the numeric value back with getEffectParameterValue: and confirm the preview changes without reapplying the package. Apply another package and query again; controls belong to the active package and may change completely.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| The parameter list is empty | No compatible package is active, or the package declares no controls | Wait for successful package application and query again |
The setter returns NO | The name or value type does not match the package metadata | Use the exact returned name and the matching numeric or string setter |
| A slider jumps outside its intended range | The app ignored hasRange, minValue, or maxValue | Build the control from the returned metadata and clamp before setting |