Hi Team, When I add watch app extension to existing ios app getting below error and unable to run cordova build ios" command.
error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp') (stack trace given below) Please help us in resolving the build issue. Problem I have added watch app extension to my existing iOS mobile app. After adding when I run "cordova build ios -verbose" in mac terminal getting below issue. Error : CordovaError: Could not parse /Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/working/myapp_watch_working_Bak/platforms/ios/myapp.xcodeproj/project.pbxproj: CordovaError: * Could not find -Info.plist file, or config.xml file. at handleBuildSettings (/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/working/myapp_watch_working_Bak/platforms/ios/cordova/lib/prepare.js:279:31) at updateProject (/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/working/myapp_watch_working_Bak/platforms/ios/cordova/lib/prepare.js:226:12) at updateWww.then (/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/working/myapp_watch_working_Bak/platforms/ios/cordova/lib/prepare.js:50:21) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) To fix this issue, I have added @leogoesger<https://github.com/leogoesger> suggested code(#764<https://github.com/apache/cordova-ios/issues/764>) in /platforms/ios/cordova/lib/projectFile.js file. replace, around 43, after prettier var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection(); var plist_file_entry = _.find(xcBuildConfiguration, function(entry) { return entry.buildSettings && entry.buildSettings.INFOPLIST_FILE; }); with var projectName = fs .readdirSync(project_dir) .find(d => d.includes(".xcworkspace")) .replace(".xcworkspace", ""); var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection(); var plist_file_entry = _.find(xcBuildConfiguration, function(entry) { return ( entry.buildSettings && entry.buildSettings.INFOPLIST_FILE && entry.buildSettings.INFOPLIST_FILE.includes(projectName) ); }); What is expected to happen? cordova build ios command should run successfully. What does actually happen? Could not find -Info.plist file, or config.xml file. issue got resolved but throwing following exception when I run cordova build ios. I am facing below issue when I run cordova build iOS command (log added below). Could you help me in resolving following issue? Running command: xcodebuild -workspace myapp.xcworkspace -scheme myapp-configuration Debug -sdk iphonesimulator -destination platform=iOS Simulator,name=iPhone 11 Pro Max build CONFIGURATION_BUILD_DIR=/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/sharedpch Build settings from command line: CONFIGURATION_BUILD_DIR = /Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/emulator SDKROOT = iphonesimulator13.2 SHARED_PRECOMPS_DIR = /Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/sharedpch note: Using new build system note: Planning build note: Constructing build description error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.application.watchapp2' for platform 'iphonesimulator' (in target 'myapp' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.application.watchapp2' for platform 'iphonesimulator' (in target 'myapp' from project 'myapp') ** BUILD FAILED ** Command finished with error code 65: xcodebuild -workspace,myapp.xcworkspace,-scheme,myapp,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 11 Pro Max,build,CONFIGURATION_BUILD_DIR=/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/platforms/ios/build/sharedpch xcodebuild: Command failed with exit code 65 Error: xcodebuild: Command failed with exit code 65 at ChildProcess.whenDone (/Users/pblrmac/Desktop/Eswar_Watch/watch_With_Notifications/myapp_watch_working_Bak/node_modules/cordova-common/src/superspawn.js:136:25) at ChildProcess.emit (events.js:189:13) at maybeClose (internal/child_process.js:970:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) Information For testing purpose I have created HelloWorld sample cordova app and added cordova ios 6.1.0 (I have tried with cordova ios 6.1.1 as well but facing same issue) after installing ios 6.1.0, I have run the build "cordova build ios" command successfully. I opened the HelloWorld app in xcode 11.3.1 and added ios watch app (In XCODE, File--> New--> Target--> select watchOS tab--> under applications select Watch App for iOS App --> click on Next button--> fill in the details and select Objective-C, select NotificationScene --> Click Finish--> Click on Activate button Then when I run "cordova build ios" in Mac Terminal getting Could not find -Info.plist file, or config.xml file. error. Then added @leogoesger<https://github.com/leogoesger> suggested code(#764<https://github.com/apache/cordova-ios/issues/764>) Then when I run "cordova build ios" again getting following errors: error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.application.watchapp2' for platform 'iphonesimulator' (in target 'myapp' from project 'myapp') error: unable to resolve product type 'com.apple.product-type.application.watchapp2' for platform 'iphonesimulator' (in target 'myapp' from project 'myapp') FYI: under watch app and extensions, Build Settings-->Architecture--> Supported Platforms -->selected watchOS(default value). Command or Code cordova build ios I have tried with -verbose, -debug, -release) Environment, Platform, Device I am using Xcode 11.3.1 with simulator Version information Using Cordova 9 Cordova - ios 6.1.0 (I have tried with cordova-ios 6.1.1 as well but facing same issue) Xcode: 11.3.1 Thanks, Eswar