Build Fail after adding Notification Service Extension in XCode

Hello Everyone,
I am trying to add support for Rich Notification(image inside notification) inside iOS.

But after adding Notification Service Extension in iOS, my build fails from ionic cli.
I can build successfully inside XCode.

I am pasting the complete verbose report from the cli.
Any help would be much appreciated.

Note: I have been scouring the web for almost 3 days now. Without any success. When I delete the Notification Service Extension target from XCode. Building from the cli once again starts to work.


MacBook-Pro:AppName username$ ionic cordova run ios --verbose
  ionic:lib Terminal info: { tty: true, ci: false, windows: false } +0ms
  ionic:lib CLI global options: { _: [ 'cordova', 'run', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +4ms
  ionic:lib:project Project type from config: Ionic 1 (ionic1) +0ms
  ionic:lib:project Project details: { configPath: '/Users/username/Work/Projects/AppName/Code/AppName/ionic.config.json', errors: [], context: 'app', type: 'ionic1' } +0ms
  ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/Users/username/Work/Projects/AppName/Code/AppName', version: '4.9.0' } +0ms
  ionic:lib:integrations:cordova:config Using config.xml: /Users/username/Work/Projects/AppName/Code/AppName/config.xml +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic cordova run' [ 'ios', '--verbose', '--interactive', '--color' ] +0ms
  ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:lib:build Looking for ionic:build npm script. +0ms
> ionic-v1 build
  ionic:v1-toolkit:lib:gulp Using gulpfile: /Users/username/Work/Projects/AppName/Code/AppName/gulpfile.js +0ms
  ionic:v1-toolkit:lib:gulp Using gulp: /Users/username/Work/Projects/AppName/Code/AppName/node_modules/gulp/index.js +3ms
[12:02:49] Cannot load gulp: Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (57)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.13.1
[12:02:49] Cannot run sass task: missing in gulpfile.js
  ionic:lib:hooks Looking for ionic:build:after npm script. +2s
> cordova run ios --verbose
No scripts found for hook "before_run".
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/restoreBackups.js
cordova-custom-config: Running restoreBackups.js
cordova-custom-config: Loaded module dependencies
cordova-custom-config: Skipping auto-restore of config file backup(s)
Executing script found in plugin cordova-custom-config for hook "before_prepare": plugins/cordova-custom-config/hooks/applyCustomConfig.js
cordova-custom-config: Running applyCustomConfig.js
cordova-custom-config: Loaded module dependencies
cordova-custom-config: Finished applying platform config
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform ios
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/AppName/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
Current launch storyboard CDVLaunchScreen
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Identifier "com.AppName.app" and iOS Bundle Version "1.9.0" to /Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/AppName/AppName-Info.plist
No need to update build settings for launch storyboard support.
iOS Product Name has not changed (still "AppName")
Updating icons at platforms/ios/AppName/Images.xcassets/AppIcon.appiconset/
Updating splash screens at platforms/ios/AppName/Images.xcassets/LaunchImage.launchimage/
Updating launch storyboard images at platforms/ios/AppName/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
Could not find *-Info.plist file, or config.xml file.
Error
    at Object.parseProjectFile [as parse] (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/lib/projectFile.js:49:15)
    at updateFileResources (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/lib/prepare.js:480:33)
    at /Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/lib/prepare.js:65:13
    at _fulfilled (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:854:54)
    at self.promiseDispatch.done (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:883:30)
    at Promise.promise.promiseDispatch (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:816:13)
    at /Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:570:49
    at runSingle (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/username/Work/Projects/AppName/Code/AppName/platforms/ios/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
[ERROR] An error occurred while running subprocess cordova.
        
        cordova run ios --verbose exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 2 functions +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +55ms
MacBook-Pro:AppName username$ ionic info

Ionic:

   ionic (Ionic CLI) : 4.9.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework   : ionic1 1.3.5
   @ionic/v1-toolkit : 1.0.8

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-webview 1.2.1, (and 27 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/username/Library/Android/sdk)
   ios-deploy        : 1.9.2
   ios-sim           : 5.0.13
   NodeJS            : v8.3.0 (/Users/username/.nvm/versions/node/v8.3.0/bin/node)
   npm               : 5.3.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2 Build version 10E125

Hello DeepakVijayan…
Did you resolve this error? I have the same problem after I added OneSignal to my project.

I dont think we can fix this issue. I wasted a lot of time on this. Its related to cordova-ios which doesn’t support multiple targets in Xcode at the moment. Not sure when they will release a support for it.

I had to drop Rich Notifications for iOS

The only workaround I found was to
1.remove the target inside Xcode while development.
2.Build from ionic cli
3.Re add Extension
4.Upload or run on a device for testing or release.

Everything works. Rich notification is working.

But this is a tedious workaround and so we decided to drop it for now.

Thank you DeepakVijayan…
I tried in many ways and was unsuccessful. In the end i did this:

  1. ionic cordova platform remove ios
  2. ionic cordova platform add ios

I Will try like you sad because it`s seems a bit leed traumatic.

Thank you. If you do find a solution. Please share.