xcode 对 iOS 应用程序进行白标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18646628/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
White labeling an iOS app
提问by Ezeki
I have a project which I'd like to white label. Basically only icons, launch images and info.plist have to be changed. The problem is that project is too big and I really don't want to add additional targets and resources to it.
我有一个项目,我想为其贴上白标。基本上只需要更改图标、启动图像和 info.plist。问题是项目太大了,我真的不想为其添加额外的目标和资源。
The solution I see is to create a separate project and add the first one as a dependency project. This white labeling project would have no code but a bunch of targets with different images and info.plists for them. In this case every time I want to white label the app I would just create another target with its own set of images. And whenever I want to make another release I could easily build all of those targets and get a bunch of variations for the same app. Sounds easy.
我看到的解决方案是创建一个单独的项目并将第一个添加为依赖项目。这个白标项目没有代码,只有一堆具有不同图像和 info.plist 的目标。在这种情况下,每次我想对应用程序进行白标时,我都会创建另一个具有自己的图像集的目标。每当我想发布另一个版本时,我都可以轻松构建所有这些目标,并为同一个应用程序获取大量变体。听起来很容易。
The problem is in implementation. I linked the project as a dependency so did I the same with target. But every time I build the app it creates an executable with the original name, even though it is different in info.plist. Probably this is because original target has its own info.plist. Another thing is how to replace the resources from the original target with another ones.
问题出在执行上。我将项目链接为依赖项,所以我对目标也是如此。但是每次我构建应用程序时,它都会创建一个具有原始名称的可执行文件,即使它在 info.plist 中不同。可能这是因为原始目标有自己的 info.plist。另一件事是如何将原始目标中的资源替换为其他资源。
Appreciate any help
感谢任何帮助
采纳答案by dtrotzjr
I did this at my job and how I did it is I have a python script that I wrote that goes in and manipulates the Info.plist with a list of replacement values that I store in an alternative plist file. We also have a build step script that goes and injects any resources we need for that particular build.
我在我的工作中做到了这一点,我是如何做到的,我有一个我编写的 python 脚本,它进入并使用我存储在替代 plist 文件中的替换值列表操作 Info.plist。我们还有一个构建步骤脚本,它可以注入我们为该特定构建所需的任何资源。
You can manipulate the bundle all you want but you have to do it just before Xcode signs the app. In some cases you might want to go in and edit the Info.plist in the bundle as well which is fine, just do it before the signing step.
您可以随心所欲地操作捆绑包,但您必须在 Xcode 签署应用程序之前进行操作。在某些情况下,您可能还想进入并编辑包中的 Info.plist,这很好,只需在签名步骤之前进行即可。
回答by David Grandinetti
I currently manage a whitelabeled iOS app. We add targets for each white label client to the main project, and have made most parts of our app configurable via a Theme.plist
file.
我目前管理着一个白标的 iOS 应用程序。我们将每个白标客户端的目标添加到主项目中,并通过Theme.plist
文件配置了我们应用程序的大部分内容。
So, each target includes all the classes for the app but has custom Info.plist
, icons, launch screens, font files, and Theme.plist
.
因此,每个目标都包含应用程序的所有类,但具有自定义Info.plist
、图标、启动屏幕、字体文件和Theme.plist
.
We avoided the approach that @dtrotzjr mentioned above because there were a few things outside of the Info.plist
file that we needed to change per target... the Provisioning Profile being a good example as well as preprocessor macros to handle the occasional #ifdef
for per-client hacks.
我们避免了@dtrotzjr 上面提到的方法,因为Info.plist
我们需要针对每个目标更改文件之外的一些内容...... Provisioning Profile 是一个很好的例子以及预处理器宏来处理偶尔#ifdef
针对每个客户端的黑客攻击.
It also made it easier for new devs to understand the build process.
它还使新开发人员更容易理解构建过程。
回答by Pafoid
Apple will now reject all white label apps, see this : https://blog.summitsync.com/did-apple-just-crush-white-label-apps-4aee14d00b78
Apple 现在将拒绝所有白标应用程序,请参阅:https: //blog.summitsync.com/did-apple-just-crush-white-label-apps-4aee14d00b78
回答by Some One
We use Bash scripts. Copy and replace app icons, splash screens, FAQs, analytics config files etc. Then pass into a config JSON file the brand colours and boolean values for different features. It gets a bit complicated when you start using sed to add and remove tablet support. It takes seconds to run. It also helps using PDFs as assets, if the asset if only one colour, then you can use tintColor for the brand colour.
我们使用 Bash 脚本。复制和替换应用程序图标、启动画面、常见问题解答、分析配置文件等。然后将不同功能的品牌颜色和布尔值传递到配置 JSON 文件中。当您开始使用 sed 添加和删除平板电脑支持时,它会变得有点复杂。运行需要几秒钟。它还有助于使用 PDF 作为资产,如果资产只有一种颜色,那么您可以使用 tintColor 作为品牌颜色。
The good thing about using Bash is that is going to be available on all CI systems.
使用 Bash 的好处是它可以在所有 CI 系统上使用。
p.s. Apple still accepts white label apps. As long as the customer is signing the xcarchive file you send them as their own, then you should be fine.
ps Apple 仍然接受白标应用程序。只要客户正在签署您发送给他们的 xcarchive 文件,那么您应该没问题。