一个应用程序是否可以注册多个与不同的应用程序ID相关联的URL方案。例如,我有针对应用程序每个环境的单独应用程序,每个应用程序都有自己独特的bundke ID。
com.test.app-dev (testapp-dev://)
com.test.app-qa (testapp-qa://)
com.test.app (testapp://)
如果我想从URL中启动开发应用程序,我需要使用testapp-dev://。
一个应用程序是否可以注册多个与不同的应用程序ID相关联的URL方案。例如,我有针对应用程序每个环境的单独应用程序,每个应用程序都有自己独特的bundke ID。
com.test.app-dev (testapp-dev://)
com.test.app-qa (testapp-qa://)
com.test.app (testapp://)
/usr/libexec/PlistBuddy -c "set :CFBundleURLTypes:0:CFBundleURLSchemes:0 testapp-dev" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
/usr/libexec/PlistBuddy -c "set :CFBundleURLTypes:0:CFBundleURLName com.test.app-dev" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
然后在 com.test.app-qa 方案中,有一个后构建操作运行此脚本:
/usr/libexec/PlistBuddy -c "set :CFBundleURLTypes:0:CFBundleURLSchemes:0 testapp-qa" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
/usr/libexec/PlistBuddy -c "set :CFBundleURLTypes:0:CFBundleURLName com.test.app-qa" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH"
这可以确保每个环境关联的应用程序都注册了正确的自定义URL方案。