解决xcode4.2安装cocos2d-x失败悲剧权限问题 Permissions Issues

在尝试安装cocos2d-x并使用xcode进行跨平台开发时,遇到了权限问题。通过sudo命令安装后,虽然安装脚本成功运行,但在xcode中未找到cocos2d-x模板。尝试手动覆盖模板文件后,虽然解决了权限问题,但编译时出现错误。经过一系列尝试,包括修改文件扩展名、设置编译选项等,问题仍未解决。最终发现可能是覆盖过程中导致的问题,并从安装日志中找到了线索,了解到需要更改文件所有者。

把持不住xcode-x跨平台得诱惑,想象只需要编写一次代码,就可以适配出ios,android,bada,等等多个平台,那将是多么美妙得事情阿,于是兴高采烈去把最新版得cocos2d-x下载下来安装,之后悲剧事情就不断上演了:

1。把cocos2d-x解压后,输入脚本./install-templates-xcode.sh安装,报错,,提示要加入sudo, -u之类得,貌似权限问题。

 2。输入安装脚本 sudo ./install-templates-xcode.sh,a 安装顺利进行,控制台提示成功,大喜!!

3。打开我可爱得xcode后,新建工程,没有看到cocos2d-x选项,顿时迷失...什么问题? Google,baidu,大搜索一通,还是有一些同道中人,感谢

 4。按照搜索来得办法,直接将cocos2d-x目录下面得template得xcode里面得问题,全部覆盖到安装目录得developer/xcdoe/templates/cocos2d-x里面,里面已经有文件,               但全部是无权限文件,直接覆盖,好啦,擦,无权限变成有权限,心想,这下应该好了吧!

5。在次打开xcode,大喜!!终于看到有cocos2d-x了,于是新建cocos2d-x工程,没问题,接着编译,一堆错误冒出来,,,悲剧阿!!!

6。怎么办呢? Google,问朋友,,什么把.cpp改为.mm啦进行混编啦?什么设置工程编译选项啦?什么版本问题没对应啦?全都是无效得,还是报一堆错误

7。哥顿时迷失了,,,,,,,,,

8。 无语,,,貌似没人遇到这个问题,人家都是有没有这个cocos2d-x  选项而已,,,哥运气的确不好,  哥得也是纯正得果本,按理也不存在啥盗版问题,,

9。还是无解,,,睡觉,,累了。。。

今早

10。一大早   爬起来,想想昨天拷贝覆盖得问题,估计应该是那个问题导致,我是强制覆盖下去得,估计会有影响,于是打开console安装日志 看看,无果

11。搜索安装权限知识,竟有惊喜发现:(~@@~) 果断control C + control V如下(某国一大特色,嘎嘎)

How:
When the installer is launched, Apple-L to show the install log, then select "Show All Logs" from the drop-down list. Run through the installation until you get the error (don't close the installer down yet). Copy and Paste the log.

Permissions Issues
A previous installer (Cocos2D as an example that does this) installs their own templates using the Root user, causing permissions issues for the PhoneGap installer, which does not need root privileges to install.

Substitute [USERNAME] below for the name of your home account.

The log might show this:

/preinstall: mkdir: /Users/[USERNAME]/Library/Developer/Xcode/Templates/Project Templates: Permission denied

In Terminal, if you do:

ls -la "/Users/[USERNAME]/Library/Developer/Xcode/" and go to the row with Templates

It would show for example:

drwxr-xr-x 12 root staff 408 3 May 00:18 Templates

That's the problem, the owner of the folder is root. You'll have to reclaim this for your current user.

How:

sudo chown [USERNAME] "/Users/[USERNAME]/Library/Developer/Xcode/Templates"

Run the installer again, and it should work this time.

顺利解决问题,高兴,吃早餐。。。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值