Ionic Capacitor: IOS build error - Searching for inspections failed: undefined method `map' for nil:NilClass

I have a Capacitor Ionic Angular application. I have recently added inapp purchase using the commands from here:

I then did my code implementation and to the npx cap sync

When I run: ionic capacitor build android, the command works without error and the android application works as expected.

However when I move over to my mac and do the same for the ios verison (ionic capacitor build ios) get a build error like so


        ### Error
        
        ```
        LoadError -
        dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle,
        0x0009): tried:
        '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o
        file, but is an incompatible architecture (have (x86_64), need
        (arm64e))) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle
        /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
        `require'
        /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in

etc


Searching for inspections failed: undefined method `map' for
nil:NilClass

before the in app purchase plugin the app builds and works fine so this issue is after I added it. I then deleted the ios folder and tried to re-add it by doing: ionic capacitor add ios

But again the above error occurs.

I am struggling to get past this error and wondering if any one can help.

Thank You

The ffi error is a know CocoaPods bug on M1 macs, best choice is to use homebrew to install CocoaPods instead of using gem install.
If you want to use gem install you have to install ffi in x86_64 mode, it’s documented in our troubleshooting docs

1 Like

Thank you!

For anyone else facing this same issue the answer works along with this