I’m new to XCode. The version I’m using is 13.4.1. I’d like to access the assets from the binary. The application is written in standard C++. The resources don’t appear to be copied to a relative path and I’m not using an API like Qt that has it’s own resource management.
Question posted in Xcode
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
2
Answers
So busy this question went unanswered a while after the solution was found. Another developer with more XCode experience helped me.
You can define macros in XCode project configuration that are expanded by the IDE when the code is built. In my case I needed to get the project root directory and use an offset to access a file. What I did was create a macro in XCode and assigned it the project's path using an XCode built-in variable.
Now anyone can use that macro to access files in the asset directory and know it'll always be a valid path on another developer's machine.
Try to reference to the complete path of the image, atleast that’s how I got it working:
I should note that I’m using the libraries:
in my project to make use of the IMG_Load() function.
Try to see how you can implement those libraries into Xcode:
here’s a video that should help you in implementing SDL.h into your ‘framework’: https://youtu.be/44tO977slsU
The process for adding the "SDL_image.h" library into your framework should be the same.
SDL2 can be downloaded from here:
https://github.com/libsdl-org/SDL/releases/tag/release-2.24.2
(make sure to pick the ‘SDL2-2.24.2.dmg’ option if you’re using a Mac)