Invalid plugin config file MyStaticlib.gdip while exporting ios project from Godot

Godot Version



I am trying to learn how to create iOS plugin for Godot engine. I just created simple iOS plugin which stores some key value data in UserDefaults and retrieve it. This is just an example, i know we don’t have to create separate plugin for every platform and i can use Gdscript's api to store some key value data as well. My goal is to learn how to create iOS plugin from scratch. Here are the steps which i followed

  1. Download Godot source code from master branch
  2. brew install scons
  3. cd to Godot source code directory in terminal and ran scons platform=ios target=template_release -j4
  4. Open xcode and selected static library for iOS
  5. Go to the downloaded godot-repo, navigate to platform / iOS folder and add this path to Build settings => Header Search Paths in Xcode
  6. Add the required code to my objective-c file & selected my iOS simulator and ran Command + B for the library to be build which is successfull
  7. Create my Godot poject in Godot editor and created a bin folder
  8. Found the libmystatticlib.a from my iOS project and copy pasted it to the bin folder of my iOS project
  9. Create a folder called iOS and inside that a plugins folder. In pulgins folder created .gdip file and copied the code from docs and refactored it according to my needs
  10. In Godot, click project => Export => Add iOS => Click Fix Import Error => Added bundle identifier & App Store team id
  11. Created a button in Godot tscn and added pressed listener to gdscript file
  12. On button pressed code , added the followed code
var bridge = load("res://ios/plugins/MyStaticlib.gdip").new()
bridge._save_value("Hello", "keyhello")

When i try to export my godot project for iOS i keep getting error saying Invalid plugin config file MyStaticlib.gdip

Which step am i doing wrong. Please help

Here is the sample ios plugin repo
Here is the sample godot project repo

While I may not be able to provide an answer for you yet, I am a couple steps away from you. I am also trying to get into the iOS plugin development. I had the same error with the photo_picker module under the godot-ios-plugins github repo. I had to rename the binary to the exact same name as the xcframework to remove my issue. I don’t think that is an issue with yours. But you can check out the rest of their gdip file and see if anything sticks out. Try maybe removing something one by one.

If you can share any sources that you are using to help you with your journey, it could help a lot.

@djolero Thanks for the reply. I think the biggest mistake which i made was to create my own static library without completely understand the whole process. I will also pick the photo-picker plugin and try to make it work during weekend. My static lib did not contain initialization and deinitialization code when i try looking at other ios plugin. Will get back to you soon

I got the photo picker code to compile into an xcframework and I added it to my Godot project. I was able to enable it in the export settings, make the ipa and test it on my iPad. I’m on Godot 4.2 and the newest xcode. I got it to request the permissions for the photo gallery and camera, and it allowed me to select a photo. I just had an error after selecting which i think is related with the Objective-C code.

Error returned from daemon: Error Code=7 "(null)"

I looked online and it seems that this is a common error when fetching photos from iOS, but not a clear solution to it.

The good thing is that it does talk back to Godot partially so there is a lot of good stuff to pick. I’m working on it today, trying to get it to work for the newer iOS. If I can figure it out, I wanna start working on the other plugins too and start making tutorials for the iOS side.

1 Like

Update: The image data is actually being sent to Godot. I see the image instance in Godot is not empty, and when checking the individual pixel color data, it seems to match the colors inside the image from the iPad. Originally I kept seeing it fill a grey color inside a TextureRect. But I quickly realized that the Godot side of the code needed a little bit of a tweak to work. So I am in fact getting an image.

_picker.connect("image_picked", self, "_image_picked")
_picker.connect("permission_updated", self, "_permission_updated")

change to:

_picker.connect("image_picked", _image_picked)
_picker.connect("permission_updated", _permission_updated)

And then also this:

func _image_picked(image):
	var texture =
	icon.texture = texture

change to:

func _image_picked(image):
	var texture = ImageTexture.create_from_image(image)
	icon.texture = texture

Changing the first 2 lines into one line made the greyed out colors go away. You just need to apply the texture to your own TextureRect or wherever.

This is currently working on my MacBook Pro M2 Ultra, Godot 4.2, Xcode 15.1.

I am gonna see if I can make your example work too.

1 Like

@djolero Brilliant.

@djolero I just downloaded the photo_picker plugin. I can’t see the xcworkspace or xcframework file. How did you opened it in xcode.

I downloaded the whole godot ios plugins repo from here:
Then I just followed the instructions on that same file.
The very last instruction tells you how to compile the xcframework.
First after downloading the repo, I rebuilt the godot inside of it to match my current version (4.2).
Then I ran the shell script to make the xcframework specifically for the photo_picker

cd godot
git fetch
git checkout origin/4.2
scons platform=ios target=template_debug 
cd ..
./scripts/ photo_picker release_debug 4.0

You might be able to change that last number to 4.2 and still have it work. It worked for me in Godot 4.2 the way I wrote it.

After it got generated, I copied the xcframework folder and the gdip file already included into my working Project folder under ios/plugins

1 Like

@djolero I created my own static library using xcode. I added the required files from the ios photo_picker plugin. I downloaded the Gogodt source code, switched to 4.2 branch and ran the following commands as well

scons platform=ios target=template_release -j4
scons p=ios target=template_debug ios_simulator=yes arch=arm64
scons p=ios target=template_debug ios_simulator=yes arch=x86_64
scons platform=iphone tools=no arget=debug arch=arm64 ios_simulator=yes
scons platform=iphone tools=no arget=release arch=arm64 ios_simulator=yes

I am not sure which one of the above command is correct, so i tried all 5 of them

I am using an m1 Mac and i want to run it on an ios simulator as i don’t have a real ios device. I added the Header Search Path in Build Settings pointing to Godot Source code of platform => iOS

Now when i try to build my project in xcode i get below error

Thanks i will try this approach

So I couldn’t get it to work on a simulator, said that I didn’t have a simulator that supports arm64, which is weird being on an M chip Mac. I’ll see if I can get it to work in a simulator. I’m still taking a look at your code, but initially what jumped out is that you had one header and one .m file, but the photo picker had 2 hearder files and used a .mm file.

1 Like

@djolero Yup i made a mistake. Can you check if the photo picker plugin works on simulator. You can ignore my code as it has lot of issues and i was not following the right template. My goal is to get some plugin working on a simulator

1 Like

I get below error. Looks like 4.2 is not supported

./scripts/ photo_picker release_debug 4.2
scons: Reading SConscript files ...

scons: *** Invalid value for option version: 4.2.  Valid values are: ['', '3.x', '4.0']
File "/Users/transformhub/Downloads/godot-ios-plugins-master/SConstruct", line 31, in <module>

Yeah because in their script file that’s what they listed as options. I initially also tried 4.2, then got that error. So I put in 4.0, and it worked fine still.

I think it’s because they haven’t really changed much between 4.0 and 4.2 as far as ios plugin integration goes since that’s not their priority.

Btw I sent you a direct message in Reddit earlier, if it makes it faster.

You really helped me out! Thank you!

1 Like

I just figured it out, check this video