Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

Adding Watch app Extension to existing iOS app cordova build ios command failing to build.(Using Cordova ios 6.1.0 and xcode: 11.3.1)

When I add watch app extension to existing ios and run cordova build ios command 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 enter code hereios -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

To fix this issue, I have added Cordova Dev Team member @leogoesger suggested code(#764) https://github.com/apache/cordova-ios/issues/764

in /platforms/ios/cordova/lib/projectFile.js file.

replaced
        
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)
        );
        });
    

This fixed above sisue after this when I run cordova build ios command getting below error.

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')


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...