Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for adding a framework to Xcode

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?

like image 616
abroekhof Avatar asked Jun 19 '26 19:06

abroekhof


1 Answers

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

like image 124
Ron Davis Avatar answered Jun 22 '26 08:06

Ron Davis