如何使用符号链接与Xcode 4和Cordova [英] How do I use symbolic links with Xcode 4 and Cordova

查看:53
本文介绍了如何使用符号链接与Xcode 4和Cordova的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获得Xcode通过www资源复制到我的基于PhoneGap的iPhone应用程序。我考虑使用Git子模块,但由于应用程序必须在不同的平台(iPhone,Android等)上工作,并且必须有不同的品牌(图像,CSS和对一些文件的小更改),它不能解决完整的问题。

I'm unable to get Xcode to copy over www resources to my PhoneGap based iPhone app. I considered using Git submodules, but since the app has to work on different platforms (iPhone, Android, etc) and has to be branded differently (images, css, and small changes to some files), it does not solve the complete problem.

我结束了一个解决方案,其中我创建了一个外部核心www文件夹,并为来自不同项目的每个文件创建了符号链接。如果一个文件需要特别注意一个平台或品牌需求,那么我可以简单地替换一个符号链接的实例与一个实际的文件。

I ended with a solution where I created an external core www folder and created symlinks for every file from the different projects. If a file needed special attention on a platform or for a branding requirement, then I could simply replace that instance of a symlink with an actual file.

这一切都会像一个魅力,但由于某种原因Xcode不会将符号链接的资源复制到手机。有没有人有任何想法如何使这项工作?或者一个固体的替代品。即使这需要我一天的时间来解决。

This all would work like a charm, but for some reason Xcode for does not copy the symlinked resources over to the phone. Does anyone have any idea how to make this work? Or a solid alternative. Even if this takes me a day to fix.

谢谢。

推荐答案

p> 此解决方案在构建时引入了符号链接。使用此方法,您可以为所有平台构建Phonegap解决方案,并使它们的品牌标记与绝对最小代码重复不同。

This solution worked perfectly to pull in the symlinks on build. Using this method you can build Phonegap solutions for all platforms and have them branded differently with the absolute minimum code duplication.

简而言之,创建一个包含所有phonegap www内容,然后将其与您的不同项目(平台差异或品牌差异)进行符号链接。要在Xcode上构建,请将以下内容添加到项目的运行脚本中:

In short, create a common directory that contains all your phonegap www contents, and then symlink this from your different projects (platform differences or branding differences). For building on Xcode, add the following to your project's run script:

rsync -pvtrlL --cvs-exclude \
    $PROJECT_DIR/../Resources* \
    $BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH

注意:如果您为BlackBerry构建,还需要取消引用符号链接。

Note: You also need to dereference symlinks if you build for BlackBerry.

这篇关于如何使用符号链接与Xcode 4和Cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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