在应用程序包中添加符号链接 [英] Adding a Symbolic Link in the Application Bundle
问题描述
Apple 在 UILocalNotification
类参考中指定音频文件必须来自应用程序包.然而,一些聪明的极客通过使用:
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";
此变通方法在 iOS 5 中运行良好,但在 iOS 6 中出现故障.为了尝试提出新的变通方法,我做了一个别名(符号链接),称为blabla.caf
指向 ../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.
现在,我收到PBXCp 错误
,Xcode 无法完成应用程序部署到设备,因为显然
Now, I am getting a PBXCp error
, and Xcode can't complete application deployment to the device because apparently
错误:/Users/stuff/moreStuff/appName/../Documents/blabla.caf:没有那个文件或目录
error: /Users/stuff/moreStuff/appName/../Documents/blabla.caf: No such file or directory
我的问题:
My Question:
- 我能否以某种方式向
Documents
目录添加一个虚拟文件 (0 KB) 以关闭 Xcode?li> - 我能否以某种方式强制 Xcode 覆盖此错误并继续
life部署应用程序?
- 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?
推荐答案
如果您将 ../../Documents/blabla.caf
的符号链接放在文件夹中,然后添加文件夹到项目(确保您在导入时设置了创建文件夹引用..."而不是创建组...")然后 Xcode 不会在构建过程中尝试解析链接.
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.
我已经验证链接本身在应用程序中运行良好,但我不确定 UILocalNotification 是否会在其 soundName 属性中接受 folder/blabla.caf
.
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屋!