月度存档: 3月 2015

xcode打包User interaction is not allowed

最近在做xcode自动打包的工具,遇到不少错误,列一下遇到错误的解决方案,以方便自己以后查看:

1、

2015-03-23 15:48:25.015 xcodebuild[10166:204416] [MT] DVTAssertions: Warning in /SourceCache/IDEFrameworks/IDEFrameworks-6611/IDEFoundation/SourceControl/Model/IDESourceControlManager.m:423
Details:  Error Domain=com.apple.dt.IDESourceControlErrorDomain Code=-1 "Missing extension: public.vcs.subversion" UserInfo=0x7f84ace487c0 {NSLocalizedDescription=Missing extension: public.vcs.subversion}
Object:   <IDESourceControlManager: 0x7f84acd73ee0>
Method:   -loadRepositories
Thread:   <NSThread: 0x7f84aac35bc0>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

只是一个警告,原因和svn有关,可以直接忽略。

2、

User interaction is not allowed。

这是网上很多人遇到问题。

是因为苹果因为安全原因,默认不允许ssh登陆读取keychain。

这里使用http://www.egeek.me/2013/02/23/jenkins-and-xcode-user-interaction-is-not-allowed/提供的解决方法。

#允许使用login.keychain
security unlock ~/Library/Keychains/login.keychain

#修改过期时间
security set-keychain-settings -t 3600 -l ~/Library/Keychains/login.keychain

#查看修改后的时间
security show-keychain-info ~/Library/Keychains/login.keychain

 

xcode 自动打包的原理很简单:

1、使用xcodebuild编译工程。

2、使用xcrun -sdk iphoneos PackageApplication,打包为ipa。

unity EntryPointNotFoundException: getifaddrs

今天打包出现这个错误:

03-19 14:00:07.815: I/Unity(16574): EntryPointNotFoundException: getifaddrs
03-19 14:00:07.815: I/Unity(16574):   at (wrapper managed-to-native) System.Net.NetworkInformation.LinuxNetworkInterface:getifaddrs (intptr&)
03-19 14:00:07.815: I/Unity(16574):   at System.Net.NetworkInformation.LinuxNetworkInterface.ImplGetAllNetworkInterfaces () [0x00000] in <filename unknown>:0 
03-19 14:00:07.815: I/Unity(16574):   at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in <filename unknown>:0 
03-19 14:00:07.815: I/Unity(16574): UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
03-19 14:00:07.815: I/Unity(16574): UICamera:Notify(GameObject, String, Object)
03-19 14:00:07.815: I/Unity(16574): UICamera:ProcessTouch(Boolean, Boolean)
03-19 14:00:07.815: I/Unity(16574): UICamera:ProcessTouches()
03-19 14:00:07.815: I/Unity(16574): UICamera:Update()

在网上搜索下:

Unfortunately this is a known bug in Mono for Android. The bug report is available here.

https://bugzilla.xamarin.com/show_bug.cgi?id=1969

是因为System.Net.NetworkInformation.GetAllNetworkInterfaces()在android上会报错导致的。

jenkens在mac下出现command not found

项目使用jenkens进行自动打包。

打包后生成的安装包上传至我们的ftp服务器供后续下载用。

上传使用的是lftp

一直提示:

/Users/sanx/Documents/sftp_upload_shell/moon_sftp_upload_10.234.10.12.sh: line 9: lftp: command not found

在网上搜索一下:http://stackoverflow.com/questions/12194294/command-not-found-in-jenkins-running-on-mac-machine

提示说可能是PATH的环境变量,jenkens使用的不相同。

于是输出登陆用户的PATH

sanxdeMac-mini-2:bin sanx$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

然后使用jenkens执行输出PATH

path1:/usr/bin:/bin:/usr/sbin:/sbin

lftp是使用的brew安装的,放在了/usr/local/bin目录下

sanxdeMac-mini-2:bin sanx$ which lftp
/usr/local/bin/lftp

找到问题就好解决了。

在/usr/bin下建一个链接,链至lftp,OK,问题解决。

按power键返回,不出现锁屏,直接进入游戏

android 4.3.x 以上版本,不知道修改了哪里,按power键返回时,会导致游戏分辨率调整。

网上大多数做法是在onConfigurationChanged重新设置游戏的分辨率,这样会在切回来时,游戏可以调整为正确的分辨率。

 

mUnityPlayer.getView().getLayoutParams().width=mUnityPlayer._displayWidth;
mUnityPlayer.getView().getLayoutParams().height=mUnityPlayer._displayHeight;

这种做法基本上算是解决了问题。

实际上更好的方式是按power button后直接返回至游戏。发现unity的debug版本可以实现这个功能,有时间需要反编译下,看看代码差异在哪里。

 

mac os 上安装linux常用工具软件

推荐强大的

Homebrew

地址:http://brew.sh/


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /opt/wordpress/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048