xcode 在应用程序包中添加符号链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13399864/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding a Symbolic Link in the Application Bundle
提问by Mazyod
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:
Apple 在UILocalNotification
类参考中指定音频文件必须来自应用程序包。但是,一些聪明的极客通过使用以下方法找到了解决此限制的方法:
// 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.
这个变通方法在 iOS 5 上运行良好,但是,它在 iOS 6 中失败了。为了尝试提出新的变通方法,我做了一个别名(符号链接),称为blabla.caf
指向../Documents/blabla.caf
,并将其放入应用程序捆。这是我被卡住了。
Now, I am getting a PBXCp error
, and Xcode can't complete application deployment to the device because apparently
现在,我得到一个PBXCp error
, Xcode 无法完成应用程序部署到设备,因为显然
error: /Users/stuff/moreStuff/appName/../Documents/blabla.caf: No such file or directory
错误:/Users/stuff/moreStuff/appName/../Documents/blabla.caf:没有这样的文件或目录
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?
- 我可以以某种方式向
Documents
目录中添加一个虚拟文件 (0 KB)以关闭 Xcode 吗? - 我能以某种方式强制的Xcode只覆盖此错误并获得
生命部署应用程序?
采纳答案by dhuntrods
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.
如果您../../Documents/blabla.caf
在文件夹内放置一个符号链接,然后将该文件夹添加到项目中(确保您在导入时设置了“创建文件夹引用...”而不是“创建组...”),那么 Xcode 将不会尝试在构建过程中解析链接。
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.
我已经验证链接本身在应用程序中运行良好,但我不确定 UILocalNotification 是否会folder/blabla.caf
在其 soundName 属性中接受。
回答by IvanRublev
Despite symlink from bundle to documents directory works in iOS 7.1, this workaround becomes unusefull if you are going to put an app in the AppStore. Since March 2014 apps with such symbolic links will not passto the review.
尽管从 bundle 到文档目录的符号链接在 iOS 7.1 中有效,但如果您要将应用程序放入 AppStore,此解决方法将变得无用。自 2014 年 3 月起,带有此类符号链接的应用将不会通过审核。
After I have uploaded app with such link in the bundle to iTunes connect I receive an Invalid binary
status immediately. With following mail from iTunes Store:
在我将捆绑包中带有此类链接的应用程序上传到 iTunes 连接后,我会Invalid binary
立即收到一个状态。来自 iTunes Store 的以下邮件:
Dear developer,
We have discovered one or more issues with your recent delivery for "X". To process your delivery, the following issues must be corrected:
Invalid Symlink - Your package contains a symbolic link 'External/Documents' which resolves to a location 'External/../../Documents' that does not exist or is outside of the package.
...
Regards,
The App Store team
亲爱的开发者,
我们发现您最近交付的“X”有一个或多个问题。要处理您的交货,必须更正以下问题:
符号链接无效 - 您的包包含符号链接“外部/文档”,该链接解析为不存在或包外的位置“外部/../../Documents”。
...
问候,
应用商店团队