Post

Replies

Boosts

Views

Activity

Reply to App Group data sharing does not work sometimes between HostApp and Service extension.
Thanks Quinn, With current implementation. yes, main app is in charge of writing, and extension is sort of read only, very rare edge case to write back. the architecture like this: app into background | special event occurred --> load User defaults and write: ----- write small set info to user defaults. // 5 pairs of key / value NSMutableDictionary* sharedDefaults = [[NSMutableDictionary alloc] init]; NSDictionary *saved = [SharedInfoManager getVomoInfo]; if(saved != nil) { [sharedDefaults addEntriesFromDictionary:saved]; } // [sharedDefaults setObject: @"Value" forKey:ONEOF_SHARED_INFO_PROPERTY_KEYS]; [SharedInfoManager setVomoInfo:sharedDefaults]; ----- + (NSDictionary *)sharedVomoInfo { return [SharedInfoManager getVomoInfo]; } + (NSDictionary *)getVomoInfo { return [self getSharedInfoWith:SHARED_VOMO_INFO]; } + (NSDictionary*)getSharedInfoWith:(NSString *)key { NSUserDefaults *userDefault = [SharedInfoManager getSharedInfo]; return [userDefault dictionaryForKey:key]; } + (NSUserDefaults*)getSharedInfo { return [[NSUserDefaults alloc] initWithSuiteName:@"group.com.myexample.project"]; } + (void)setVomoInfo:(NSDictionary *)info { [self setSharedInfo:SHARED_VOMO_INFO withValue:info]; } + (void)setSharedInfo:(NSString*) key withValue:(NSDictionary*)info { NSUserDefaults* defaults = [SharedInfoManager getSharedInfo]; [defaults setObject:info forKey:key]; [defaults synchronize]; } if I am not mistaken, It could be something like { // return [self getSharedInfoWith:SHARED_VOMO_INFO]; NSData *data = [NSData dataWithContentsOfFile:path options:0 error:&error]; NSDictionary *info = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; } + (void)setVomoInfo:(NSDictionary *)info { //[self setSharedInfo:SHARED_VOMO_INFO withValue:info]; NSData *dataFromDict = [NSJSONSerialization dataWithJSONObject:dict options:nil error:&error]; [NSData writeToURL:options:error:] } is it thread safe? again, much appreciated your help for this.
Topic: App & System Services SubTopic: General Tags:
4w
Reply to WKWebView could not access local javascript files
On my end, it was due to call [self.webView loadFileURL:fileURL allowingReadAccessToURL:accessURL]; multiple times, even though it was worked on earlier version. here is the response from Apple side The loadFileURL:allowingReadAccessToURL: call should be made only once, after all the resource files have been copied. The CSS and image files don't need to be loaded individually — they will be loaded automatically by the HTML when it references them, because your accessURL grants WKWebView read access to the entire cv_webroot directory. Here is what the corrected flow should look like: hope this helps.
Topic: Safari & Web SubTopic: General Tags:
Mar ’26
Reply to WKWebView could not access local javascript files
here is error signature: start setting access permission file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/CM_chat_view_base.html with accessURL file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/ 0x12c0d40c0 - [PID=1514] WebProcessProxy::hasAssumedReadAccessToURL(3198190): no access complete setting access permission file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/CM_chat_view_base.html with accessURL file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/
Topic: Safari & Web SubTopic: General Tags:
Mar ’26
Reply to App Group data sharing does not work sometimes between HostApp and Service extension.
Thanks Quinn, With current implementation. yes, main app is in charge of writing, and extension is sort of read only, very rare edge case to write back. the architecture like this: app into background | special event occurred --> load User defaults and write: ----- write small set info to user defaults. // 5 pairs of key / value NSMutableDictionary* sharedDefaults = [[NSMutableDictionary alloc] init]; NSDictionary *saved = [SharedInfoManager getVomoInfo]; if(saved != nil) { [sharedDefaults addEntriesFromDictionary:saved]; } // [sharedDefaults setObject: @"Value" forKey:ONEOF_SHARED_INFO_PROPERTY_KEYS]; [SharedInfoManager setVomoInfo:sharedDefaults]; ----- + (NSDictionary *)sharedVomoInfo { return [SharedInfoManager getVomoInfo]; } + (NSDictionary *)getVomoInfo { return [self getSharedInfoWith:SHARED_VOMO_INFO]; } + (NSDictionary*)getSharedInfoWith:(NSString *)key { NSUserDefaults *userDefault = [SharedInfoManager getSharedInfo]; return [userDefault dictionaryForKey:key]; } + (NSUserDefaults*)getSharedInfo { return [[NSUserDefaults alloc] initWithSuiteName:@"group.com.myexample.project"]; } + (void)setVomoInfo:(NSDictionary *)info { [self setSharedInfo:SHARED_VOMO_INFO withValue:info]; } + (void)setSharedInfo:(NSString*) key withValue:(NSDictionary*)info { NSUserDefaults* defaults = [SharedInfoManager getSharedInfo]; [defaults setObject:info forKey:key]; [defaults synchronize]; } if I am not mistaken, It could be something like { // return [self getSharedInfoWith:SHARED_VOMO_INFO]; NSData *data = [NSData dataWithContentsOfFile:path options:0 error:&error]; NSDictionary *info = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error]; } + (void)setVomoInfo:(NSDictionary *)info { //[self setSharedInfo:SHARED_VOMO_INFO withValue:info]; NSData *dataFromDict = [NSJSONSerialization dataWithJSONObject:dict options:nil error:&error]; [NSData writeToURL:options:error:] } is it thread safe? again, much appreciated your help for this.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
4w
Reply to App Group data sharing does not work sometimes between HostApp and Service extension.
Thanks Quinn. yes for now, I would suspect there will be more cases coming in
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’26
Reply to WKWebView could not access local javascript files
On my end, it was due to call [self.webView loadFileURL:fileURL allowingReadAccessToURL:accessURL]; multiple times, even though it was worked on earlier version. here is the response from Apple side The loadFileURL:allowingReadAccessToURL: call should be made only once, after all the resource files have been copied. The CSS and image files don't need to be loaded individually — they will be loaded automatically by the HTML when it references them, because your accessURL grants WKWebView read access to the entire cv_webroot directory. Here is what the corrected flow should look like: hope this helps.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’26
Reply to WKWebView could not access local javascript files
Thanks Apple, I filed DTS ticket, and get the solution from Apple Engineer. It is resolved.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’26
Reply to WKWebView could not access local javascript files
here is error signature: start setting access permission file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/CM_chat_view_base.html with accessURL file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/ 0x12c0d40c0 - [PID=1514] WebProcessProxy::hasAssumedReadAccessToURL(3198190): no access complete setting access permission file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/CM_chat_view_base.html with accessURL file:///var/mobile/Containers/Data/Application/9044BAAF-5152-4C71-A3BA-5292C6FEED70/Documents/cv_webroot/
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’26