Reputation: 796
My app was rejected by the App Store for the following reason.
The app references frameworks in a fragile manner, which might result in bugs.
The app references the following frameworks using a relative path:
'/Library/Frameworks/iTunesLibrary.framework'
Best Mac OS X development practices suggest using (in order)
@executable_path/ @loader_path/ @rpath/
For more information about linking frameworks, please see the following documents:
Run-Path Dependent Libraries section of Dynamic Library Programming Topics
dyld(1) man page
I've read the suggested documents but I don't understand how they relate to my project. I am trying to include iTunesLibrary.framework
, which doesn't seem to be a dynamic library. What is the best practice for adding non-standard frameworks to a project? Should that path be absolute?
Upvotes: 3
Views: 403
Reputation: 1355
Your problem here probably isn't about framework best practice. Rather it is because of iTunes Library weirdness.
In order to avoid having to include the explicit path to iTuneLibrary, you need to add "/Library/Frameworks" to your project's Framework Search Paths in Build Settings. (Yeah I know that's weird).
Then the library won't load and gives you a cryptic error:
Could Not load iTunes Library because of error: Error Domain=NSPOSIXErrorDomain Code=100001 "Could not load." UserInfo=0x10340eaa0 {NSLocalizedDescription=Could not load., NSUnderlyingError=0x10341c610 "The operation couldn’t be completed. (OSStatus error 100005.)"}
This is because your app isn't code signed. You'll need to code sign it to make it work.
Source and Example: https://github.com/zadr/iTunesLibraryExample
Upvotes: 2
Reputation: 4058
Best practice for linking a framework:
Add the framework to the list of linked libraries: 'Project >> Build Phases > Link Binary with Libraries'
Then you can reference the library using angle brackets:
#import <QuartzCore/QuartzCore.h>
Upvotes: 0