Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

ios - Adding a Symbolic Link in the Application Bundle

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 apparently

error: /Users/stuff/moreStuff/appName/../Documents/blabla.caf: No such file or directory


My Question:

  1. Can I somehow add a dummy file (0 KB) to the Documents directory just to shut Xcode up?
  2. Can I somehow force Xcode to just override this error and get on with life deploying the app?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 pass to the review.

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:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...