Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module 'Capacitor' in AppDelegate.swift

I'm working on an Ionic React Project running on top of Capacitor. I added Android platform and everything went smoothly. Now that I'm trying to make my app work in iOS (first time working with iOS), after adding ios platform and open my project in XCode, I ran into some issues.

See the errors:

enter image description here

enter image description here

Podfile content:

enter image description here

Any help would be really appreciated. Thank you!

like image 596
Ani Avatar asked Dec 30 '22 13:12

Ani


2 Answers

For anyone interested, I deleted ios folder and added iOS platform again. After that, instead of running 'pod install' (I got errors via this command), I used these commands:

in regular terminal, outside the Project directory:

sudo arch -x86_64 gem install ffi

then inside iOS folder

arch -x86_64 pod install

After these commands, all capacitor pods/plugins got installed successfully. I opened the app using this command: ionic cap open ios and got an error: No module Capacitor found, but anyway I ignored this error and ran/build the app inside XCode. The emulator got opened successfully and the app ran smoothly.

like image 188
Ani Avatar answered Jan 05 '23 16:01

Ani


I faced the same problem today. After doing some research I finally made my project work on iOS! I am using Angular version 9. I could not run the XCode project since ionic would not create the required podfile. I simply created the iOS app with npx first and then used ionic to run a live reload of my app. The commands are the following:

  1. npm install @capacitor/ios
  2. npx cap add ios
  3. ng build (creates the www directory)
  4. npx cap open ios
  5. ionic capacitor run ios --livereload --external
  6. Run the app from XCode in order to get the app's logs during runtime

(Sources: npx and ionic)

like image 45
Konstantinos Avatar answered Jan 05 '23 15:01

Konstantinos