home_widget icon indicating copy to clipboard operation
home_widget copied to clipboard

[iOS] So far, only UserDefault can be used to share data with the main runner?

Open BenderBlog opened this issue 1 year ago • 0 comments

Just curious, not bug. This plugin is awesome!

To be clear, a Swift beginner...

In Apple devices, we have to use groupid to share data between the main app and HomeWidget, UserDefault is used in this plugin. My data is too huge (related to schedule data, about 10kb), maybe too huge to put it in the UserDefault. Although I use background_fetch to update the plugin every 15 minute, somebody said that it may be killed sometimes. Don't know whether it is true, but I was thinking, could I read data from the main app, via groupid?

Since groupid is used, I tried to use an alternative way, by reading the shared data folder:

let appSupportURL = FileManager().containerURL(forSecurityApplicationGroupIdentifier: widgetGroupId)!

By the way, the data I read is stored in Application Support Directory as defined by path_provider plugin. And unfortunately, it failed, saying that these two folder is not the same. Application Support Directory means the private main runner data, it seems...

e8a1e572f0d65edc960064389bbec785

So, is there anyway to store data to the shared folder in the main runner, the Flutter code? I mean, since groupid provided...

BenderBlog avatar Jan 14 '24 14:01 BenderBlog