SuperDeclarative
SuperDeclarative

Reputation: 1669

How do I add new Headers to Flutter plugin iOS project?

I'm working on a Flutter plugin on the iOS side. Initially the generated code for the plugin includes:

MyPlugin.h MyPlugin.m

I have added a new class in the same directory as the plugin source files:

MyClass.h MyClass.m

When I include MyClass.h within MyPlugin.m, everything works fine.

When I include MyClass.h within MyPlugin.h, the build fails and complains that MyClass.h cannot be found.

What do I have to do to expose MyClass.h to MyPlugin.h?

I tried configuring the plugin "target" to include MyClass.h under the "Project" section of "Headers" but that didn't help.

Then I dug into the file system a bit and I see that the existing MyPlugin.h is being symlinked example/ios/Pods/Headers/Public/my_plugin/MyPlugin.h and also example/ios/Pods/Headers/Private/my_plugin/MyPlugin.h. However, my MyClass.h header is not symlinked to those locations and I have no idea why.

I'm guessing there is something I have to update about the plugin's Podfile? But I'm not sure...

Upvotes: 0

Views: 718

Answers (1)

SuperDeclarative
SuperDeclarative

Reputation: 1669

It was pointed out to me that my version of Cocoapods (1.3.1) might be the problem.

I upgraded Cocoapods to 1.5.0 and ran pod install from the example project and the issues seem to be resolved.

Upvotes: 1

Related Questions