Bundling the OSX API with the compiled app

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Bundling the OSX API with the compiled app

Postby Lapo » 22 Mar 2013, 08:58

Hello there,
it looks funny to post a question here :)

As I am working on a simple OSX/SFS2X app, I noticed that the compiled "product" does not include the API framework. Therefore it fails to run on any machine that doesn't have the SFS2XAPIOSX framework installed.

From what I read this doesn't depend on my project settings but on how the framework was compiled? Is this correct or have I misunderstood?

Is there anything I can do under XCode to pack the framework in the app bundle?
Currently using XCode 4.6

Thanks,
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Bundling the OSX API with the compiled app

Postby A51Integrated » 22 Mar 2013, 11:45

Sure. Assuming the SFS framework is already linked to the project (or any 3rd party framework for that matter), simply go to your projects Build Phases and add the framework to the "Copy Bundle Resources" section. That will actually copy the framework into your compiled app. See the Apple docs for a more detailed description: http://developer.apple.com/library/mac/ ... works.html
A51 Integrated
http://a51integrated.com / +1 416-703-2300
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bundling the OSX API with the compiled app

Postby Lapo » 22 Mar 2013, 11:55

Thanks. I thought of that but I am not sure if I understand how this should be done exactly.
In the Copy Bundle Resources panel I click the plus button and it shows this item:
Schermata 03-2456374 alle 12.34.48.png
(43.46 KiB) Not downloaded yet


From there I am not able to select the SFS2XAPIOSX framework, therefore I click the Add Other... button, navigate to the framwork location and at this point XCode asks if I want to add the resource to the project, again! Which doesn't sound right.

Is this the right way to proceed or am I missing something?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Bundling the OSX API with the compiled app

Postby A51Integrated » 22 Mar 2013, 12:05

From Apple:

The following steps show you how to configure your application target.
  • In the Group & Files pane, open your application target to view its current build phases.
  • Drag your framework product (located in the Products folder) to the existing Link Binary With Libraries build phase of your application target. This causes the application to link against your framework.
  • Add a new Copy Files Build Phase to the application target. (This phase will be used to install the framework in the application bundle.)
  • Select the new build phase and open an inspector window.
  • In the General tab of the inspector window, set the destination for the build phase to “Frameworks”.
  • Drag your framework product to the new build phase.
  • Select the application target again and open the inspector window.
  • In the General tab of the inspector window, add your framework as a dependency for the application. Adding this dependency causes Xcode to build the framework target before building the application target.

Let me know how that goes.
A51 Integrated

http://a51integrated.com / +1 416-703-2300
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Bundling the OSX API with the compiled app

Postby Lapo » 23 Mar 2013, 12:14

Thanks,
there is one more problem. The framework is apparently compiled so that it requires to be found in this position:

Code: Select all

/Library/Framewoeks/SFS2XAPIOSX.framework/...

even if the framework gets bundled with the Application.

In fact even with the framework properly copied in the app bundle, the Application fails to start with an error like this:
dyld: Library not loaded: /LIbrary/Framewoeks/SFS2XAPIOSX.framework/...
Image not found


Not being very familiar with this concept it sounded strange, but a quick research confirmed the issue:
http://stackoverflow.com/questions/1621 ... n-in-xcode

I had to download the additional command line tools and fix the problem with the install_name_tool terminal command.

Wouldn't it be better to change this setting at the time of compilation of the framework, to avoid distribution problems?
Also, I guess this is not a problem with iOS, only MacOS

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: Bundling the OSX API with the compiled app

Postby A51Integrated » 23 Mar 2013, 13:41

Try this: In the workspace select the framework project in the left sidebar, and navigate to the build settings for the framework target. You should see “Info”, “Build Phases”, and “Build Rules” listed along with “Build Settings”. Scroll down through the options and find the "Installation Directory" option listed under "Deployment" and change the path from the default value to

Code: Select all

@executable_path/../Frameworks
and click done/enter. This will tell Xcode that the framework will be embedded in an application.

Let me know if that works.
A51 Integrated

http://a51integrated.com / +1 416-703-2300

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 37 guests