Not able to create ios app

#1

Please help…

I have built an app and I am trying to test it on an iPhone but I am getting an error message.

I am entering this code on cli inside the apps directory:

ionic cordova platform add ios
and
ionic cordova build ios

Then I get this error message:

No need to update build settings for launch storyboard support.
Set IPHONEOS_DEPLOYMENT_TARGET to "11.0".
Did not update build settings for launch storyboard support.
iOS Product Name has not changed (still "Commit2")
Updating icons at platforms/ios/Commit2/Images.xcassets/AppIcon.appiconset/
Updating splash screens at platforms/ios/Commit2/Images.xcassets/LaunchImage.launchimage/
Updating launch storyboard images at platforms/ios/Commit2/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
CordovaError: Promise rejected with non-error: "xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance\n"
    at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
[ERROR] An error occurred while running subprocess cordova.
        
        cordova build ios --verbose exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more 
        information.
  ionic:utils-process onBeforeExit handler: process.exit received +0ms
  ionic:utils-process onBeforeExit handler: running 2 functions +0ms
  ionic:utils-process onBeforeExit handler: exiting (exit code 1) +26ms
#2

I had similar issue when running ionic cordova build ios --prod. Well to solve this issue there some stuffs have to check:

First make sure you have Xcode Installed with command line tools also
If you have Xcode installed already check the version and your mac version to download the right command line tools.
Download the command line tools here Command Line Tools
After install it and run this command to fix the xcode-select path

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

After this run the command again. Am sure this will work for you