I am trying to test out my app on iOS and for the life in me I cannot get it to build the app. I can run ionic serve, no problem, I can run ionic run android, no problem, but it will not build the iOS Xcode project. The first set of errors was saying …
Error: Type AddPostPage in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.ts is part of the declarations of 2 modules: AppModule in /Volumes/SharedFolders/shared_app/src/app/app.module.ts and AddPostPageModule in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.module.ts! Please consider moving AddPostPage in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.ts to a higher module that imports AppModule in /Volumes/SharedFolders/shared_app/src/app/app.module.ts and AddPostPageModule in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.module.ts. You can also create a new NgModule that exports and includes AddPostPage in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.ts then import that NgModule in AppModule in /Volumes/SharedFolders/shared_app/src/app/app.module.ts and AddPostPageModule in /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.module.ts.
So I tried to remove the add-post-page.module.ts file and run it again, now I get the following error…
Error: /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.ts has a @IonicPage decorator, but it does not have a corresponding “NgModule” at /Volumes/SharedFolders/shared_app/src/pages/add-post-page/add-post-page.module.ts
So, if I have the .module.ts file it complains that it’s there, if I remove it it complains that it isn’t there. A side note, I never created any of the .module.ts files. I open the command line and run ionic g page AddPostPage and it puts those .module.ts files in the directory.
How can I build iOS? If I leave the module.ts files it will complain, but it I remove them it will complain. Seems a little paradoxical to me. You can’t have this file, wait the file I said you can’t have isn’t there. Please help, this is driving me nuts. Thank you.