Xcode iOS target: message 'dyld: Library not loaded (…) required code signature missing'

I’ve got a SDL2 project, which runs fine for MacOS. But when I try to export to iOS the build is succesfull and then the simulator crashes with the following message:

dyld: Library not loaded: @rpath/libSDL2.dylib Referenced from: /Users/martinjoselizondocolomes/Library/Developer/CoreSimulator/Devices/F0FC3BBB-4809-4E45-B6BA-3709A2E82987/data/Containers/Bundle/Application/DCAE530F-9AB5-4E23-AD51-0CBC8B58297D/my_sdl_ios_project.app/my_sdl_ios_project Reason: no suitable image found. Did find: /Users/martinjoselizondocolomes/Library/Developer/Xcode/DerivedData/my_sdl_ios_project-gupmbcbolzvwmdfiuqsguhjlxnxo/Build/Products/Debug-iphonesimulator/libSDL2.dylib: required code signature missing for ‘/Users/martinjoselizondocolomes/Library/Developer/Xcode/DerivedData/my_sdl_ios_project-gupmbcbolzvwmdfiuqsguhjlxnxo/Build/Products/Debug-iphonesimulator/libSDL2.dylib’

I’ve tried to use the SDL template and example projects that come up in the SDL XCode IOS folder with no luck. Always the same issue.

It needs to be code signed, with the same signature as your app itself.

Also, you’re gonna have a way easier time, IME, if you use SDL2.framework instead of directly linking to the dylib. When you do that, Xcode will see that you’re linking to an external framework and automatically set it to be included with your app and code signed.

Thanks for the info. I generally use SDL2.framework, but this time I don’t have the iOS framework, so I needed to build the dylib file from the source code included in the xCode iOs folder. Could you explain me how do I “code sign”?