MaxAst / expo-share-extension

Expo config plugin for creating iOS share extensions with a custom view.
MIT License
224 stars 6 forks source link

openHostApp opening the wrong app bundle #55

Open nhuesmann opened 1 week ago

nhuesmann commented 1 week ago

This is more of a configuration question, but still an issue during development so I figured I'd post it.

I have 3 separate bundle ids:

In my app.json however, I just have 1 scheme set ("myapp"). When I'm in the dev share extension and call openHostApp, it will open the QA app rather than the dev client app. I'd love for each share extension instance to open its corresponding bundle, since I and my QA team have multiple bundles installed at once. Is there a way around this? Do I need to set up multiple different schemes? Any help would be appreciated, thanks!

MaxAst commented 1 week ago

Hey @nhuesmann, in my team we have a dedicated scheme for each environment. That should solve the problem

nhuesmann commented 1 week ago

@MaxAst Thanks so much, I'll try implementing this. Is it as straightforward as just setting it dynamically in app.config.ts? I just wasn't sure because the docs only mention dynamic schemes in the context of bare workflow.

MaxAst commented 1 week ago

Yea you can set it via app.config.ts

nhuesmann commented 1 week ago

@MaxAst I just removed scheme from app.json and am now setting it via dynamic config in app.config.ts. Using appname-dev, appname-qa, and appname depending on the build channel. I just built new dev and qa apps with this, then tested the share extension again. This time, openHostApp actually does nothing - it doesn't open any of the apps.

One thing I'm noticing as I'm trying to debug this: I'm not sure the scheme name is even being used when I run expo prebuild. Take dev for example - in app.config.ts I have the name set to "Appname DEV", and the scheme set to "appname-dev". When I look at the ios folder generated by prebuild, the folders inside are all AppnameDEV, AppnameDEV.xcodeproj, etc. When I load the project in XCode and check the scheme, it's also showing the scheme as AppnameDEV rather than appname-dev. Is this causing an issue? Is prebuild ignoring my scheme? One additional piece to note is that I've also set the following in app.json:

"ios": {
    "infoPlist": {
        "CFBundleURLTypes": [
            {
                "CFBundleURLSchemes": [
                    "appname",
                ]
            }
        ],
    }
}

Do I need to add scheme info there too?

Sorry I realize this may be getting out of scope of your library, I'm just trying to troubleshoot and really haven't found any good info on this in my extensive searching.