cordova-ios
cordova-ios copied to clipboard
error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp')
Bug Report
error: unable to resolve product type 'com.apple.product-type.watchkit2-extension' for platform 'iphonesimulator' (in target 'myapp Extension' from project 'myapp')
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 suggested code(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 suggested code(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
Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above
I am struggling to over come this issue. Any help on this issue is very much appreciated.
Still I am struggling to over come this issue. Any help on this issue is very much appreciated.
@ejonnadula I am facing the same issue for now I just leave my iPhone plugged in. It has an Apple Watch connected I assume that makes a difference. Ultimately I think Cordova needs to add the watch SDK to the build command but I didnt get that far with integrating the watch app yet.
Thanks for your response Philip. When I run "cordova build ios" command my iphone not connected to Mac system, and no iphone/watch app simulator is up.
Dear team, I am still struggling to over come this issue. Any help on this issue is very much appreciated.
also facing same issue;hope perfect methods
Dear team, its quite long time any help on this issue from cordova team is very much appreciated.