Home iOS Development ios – Reducing app size – on demand resources not supported on WatchOS

ios – Reducing app size – on demand resources not supported on WatchOS

0

[ad_1]

I have a large local realm file (150mb) included my bundle which makes my initial watch-only app larger than the 75mb watch limit, so I’m trying to think of a way to make this work. I thought about on demand resources (and maybe splitting up the DB into smaller chunks), but the following code example works fine on iOS but not watchOS leading me to think that it’s not supported.

On Demand Resources:

struct ContentView: View {
    var body: some View {
        Text("Hello, world!")
        .onAppear {
            let request = NSBundleResourceRequest(tags: ["odr"])
            request.beginAccessingResources { error in
                if let error = error { print(error); return }
                print("Access")
            }
        }
    }
}

Error:

2022-11-17 15:29:37.007672+0900 odr-watch Watch App[62051:1667291] [general] NSBundleResourceRequest could not connect to its helper daemon
2022-11-17 15:29:37.007824+0900 odr-watch Watch App[62051:1667508] NSBundleResourceRequest could not connect to its helper daemon
2022-11-17 15:29:37.007878+0900 odr-watch Watch App[62051:1667508] NSBundleResourceRequest could not connect to its helper daemon
Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.ondemandd.client was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.ondemandd.client was invalidated: failed at lookup with error 3 - No such process.}

I would appreciate if anyone has any advice or direction for me to get larger resources into a WatchOS only app.

[ad_2]