添加在应用程序中捆绑符号链接 [英] Adding a Symbolic Link in the Application Bundle
问题描述
苹果指定的 UILocalNotification
类引用该音频文件必须从应用程序包。然而,一些聪明的怪胎已经通过找到他的方式绕过这个限制:
//这个工作原理是往上走的包目录,然后指向文档目录
localNotif.soundName = @../文件/ blabla.caf
此解决方法已在iOS 5的效果不错,但是,它在iOS的6打破在绝望的尝试,试图拿出一个新的解决方法,我做了一个别名(符号链接)称为 blabla.caf
,它指向 ../文件/ blabla.caf
,并将其放置到应用程序包。这是我卡住了。
现在,我得到一个 PBXCp误差
和X code不能完整的应用程序部署到设备,因为显然
错误:/Users/stuff/moreStuff/appName/../Documents/blabla.caf:没有这样的文件或目录
块引用>我的问题:
- 我可以以某种方式添加一个虚拟文件(0 KB)为
文件
目录只是关闭X code最大?- 我可以以某种方式强制X code到刚刚覆盖此错误并获得<罢工>生活击>部署应用程序?
解决方案如果你把一个符号链接
../../文件/ blabla.caf
A文件夹中,然后将文件夹添加到项目(确保你有创建文件夹引用...进口替代设置创建组...),那么X code不会尝试解析链接在构建过程中。我已验证链接本身的应用程序工作正常,但我不知道把我的头顶部,如果UILocalNotification将接受
文件夹/ blabla.caf
在soundName财产。Apple specifies in the
UILocalNotification
class reference that the audio file must be from the application bundle. However, some smart geek has found his way around this limitation by using:// this works by going up the bundle dir, then pointing to the Documents dir localNotif.soundName = @"../Documents/blabla.caf";
This workaround has worked well with iOS 5, however, it broke in iOS 6. In a desperate attempt to try and come up with a new workaround, I made an alias (Symbolic Link) called
blabla.caf
that points to../Documents/blabla.caf
, and placed it into the application bundle. This is were I got stuck.Now, I am getting a
PBXCp error
, and Xcode can't complete application deployment to the device because apparentlyerror: /Users/stuff/moreStuff/appName/../Documents/blabla.caf: No such file or directory
My Question:
- Can I somehow add a dummy file (0 KB) to the
Documents
directory just to shut Xcode up?- Can I somehow force Xcode to just override this error and get on with
lifedeploying the app?
解决方案If you place a symlink to
../../Documents/blabla.caf
inside a folder, and then add the folder to the project (making sure that you have "Create folder references..." set on import instead of "Create groups...") then Xcode won't try to resolve the link during the build process.I've verified that the link itself works fine in the app, though I'm not sure off the top of my head if UILocalNotification will accept
folder/blabla.caf
in its soundName property.这篇关于添加在应用程序中捆绑符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!