一个项目,两个版本? (沙盒和非开箱的版本)?任何简单的方法来维护代码? [英] one project, two versions? (sandboxed and nonsandboxed version)? any easy way to maintain the code?

查看:219
本文介绍了一个项目,两个版本? (沙盒和非开箱的版本)?任何简单的方法来维护代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个可可项目,现在它有两个版本,沙盒和非沙箱版本。



沙盒和非沙盒版本之间有一些区别,沙箱版本,但大多数是相同的。即。对于沙盒版本我将有限的访问某些目录,为了访问一些目录,如桌面我将不得不添加权利。对于非沙盒版本,我没有对目录的限制,也允许添加检查更新aka sparkle框架等。



两者仍然处于测试模式(即尚未提交到Mac应用商店),现在,我如何分离它们是,我有非分支版本的主分支,以及一个新的分支为沙箱版本。 p>

然而更新代码是屁股的痛苦。一旦我为非沙盒版本实现了一些功能,我不得不提交更改,然后将更改合并到沙箱分支。事情是,我不能只是合并所有的变化到沙盒版本,我必须小心,只有合并功能的变化我做了。



你开发的应用程序沙箱和非沙箱,你如何处理这种情况。是否有任何简单的方法来维护代码?

解决方案

我认为一个好的方法是使用define(SANDBOX)并为sandbox版本创建两个目标,其中包括entitlements文件和SANDBOX定义,以及没有授权文件和SANDBOX定义的目标。



在类中,其中程序必须表现不同的功能,您可以使用此定义(SANDBOX)轻松地分离沙箱和非沙箱版本的代码。


I have developed a cocoa project and right now it has two versions, both sandboxed and non-sandboxed version.

there are some differences between the sandboxed and non-sandboxed version, but the majority is the same. ie. for sandboxed version I will have limited access to certain directories, and in order to access some directories like desktop I'll have to add the entitlement. for the non-sandboxed version, I'll have no limitation on the directories, also I am allowed to add the "check for update" aka sparkle framework etc.

both are still in testing mode (ie. not yet submitted to the mac app store) and right now, how I separate them was, I have the master branch for the non-sandboxed version, and a new branch for the sandboxed version.

however updating code is a pain in the butt. Once I have implemented some features for the non-sandboxed version, I had to commit the changes, then merge the changes back to the sandboxed branch. The thing is, I can't just merge all the changes to the sandboxed version, I have to be careful, only merge the feature changes I made.

So for those of you who developed app for both sandboxed and non-sandboxed, how do you deal with such situation. Is there any easy way to maintain the code?

解决方案

I think a good approach is to use a define (SANDBOX for example) and to create two targets one for the sandbox version which include the entitlements file and the SANDBOX define, and one which has no entitlements file and no SANDBOX define.

In the classes, functions in which the program must behaves different, you can easily separate the code for the sandboxed and non-sandboxed versions using this define (SANDBOX).

这篇关于一个项目,两个版本? (沙盒和非开箱的版本)?任何简单的方法来维护代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆