Prerequisites
- A working iOS quickstart
- Cloud Filters enabled for the project
Request the catalog
NosmaiCloudFilterRequestOptions *options =
[NosmaiCloudFilterRequestOptions defaultOptions];
options.page = 1;
options.limit = 20;
options.version = NosmaiCloudFilterVersion2;
options.filterType = @"effects";
[[NosmaiCore shared].effects
getCloudFiltersWithOptions:options
completion:^(NSArray<NSDictionary *> *filters,
NosmaiCloudFilterPaginationInfo *pagination,
NSError *error) {
if (error != nil) NSLog(@"Catalog failed: %@", error.localizedDescription);
}];
Download and apply
[[NosmaiCore shared].effects
downloadCloudFilter:filterId
progress:^(float progress) {
NSLog(@"Download %.0f%%", progress * 100.0f);
} completion:^(BOOL success, NSString *downloadedPath, NSError *error) {
if (success && downloadedPath.length > 0) {
[[NosmaiCore shared].effects applyEffect:downloadedPath completion:nil];
}
}];
Deduplicate taps by Cloud Filter identifier and apply only after the download completes successfully.
Handle cache eviction
Use isCloudFilterDownloaded: or getCloudFilterLocalPath: at the time of selection. The cache has no documented permanent TTL and iOS can reclaim cache storage. If the filter is unavailable, download it again. Persist the Cloud Filter identifier rather than the temporary download location.
Verify it worked
Apply the item again from cache after turning off network access. Do not issue a new download for an already cached item.
Common errors
| Symptom | Fix |
|---|---|
| Empty catalog | Check cloud capability, category, pagination, and request error |
| Download stops | Preserve the current effect, show Retry, and do not use a partial path |
| Apply fails | Apply only the successful Cloud Filter download result |