I created a cordova project using cordova create project hello com.hello Hello
.
And added iOS platform using cordova platform add iOS
.
And tried to do cordova run ios
after cordova build ios
.
But it shows me this error(I used --d/ --verbose to get the details).
/usr/bin/codesign --force --sign - --timestamp=none /Volumes/Untitled/Plot/PlotReel/platforms/ios/build/emulator/PlotReel.app /Volumes/Untitled/Plot/PlotReel/platforms/ios/build/emulator/PlotReel.app: replacing existing signature
** BUILD SUCCEEDED **
No scripts found for hook "before_deploy". Error: TypeError: Cannot read property 'replace' of undefined
at remove (/Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:282:70) at Array.forEach (native) at Object.getdevicetypes (/Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/ios-sim/src/lib.js:292:22) at Object.listEmulatorImages [as run] (/Volumes/Untitled/Plot/test/platforms/ios/cordova/lib/list-emulator-images:34:29) at deployToSim (/Volumes/Untitled/Plot/test/platforms/ios/cordova/lib/run.js:146:50) at /Volumes/Untitled/Plot/test/platforms/ios/cordova/lib/run.js:88:20 at _fulfilled (/Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/q/q.js:796:13) at /Volumes/Untitled/Plot/test/platforms/ios/cordova/node_modules/q/q.js:604:44
I have tried uninstalling and installing cordova again, but the problem is still remaining.
Please help me.
There is a PR on Github which fixed my problem: https://github.com/phonegap/ios-sim/pull/213
Just called following inside my project root
and added the function to filter the device name, as pointed out here: https://github.com/phonegap/ios-sim/pull/213/files
I had the same error. For me I traced this down into a bug in platforms/ios/cordova/node_modules/ios-sim/src/lib.js
The error always occured as "TypeError: Cannot read property 'replace' of undefined" in lib.js:289
So I inserted some debug code:
This worked for me. Good luck.
and got the following output:
Notice how filterDeviceName removed the minus character while filling the hash. When the value is retrieved again, the filter is not applied and the program fails.
Bug fix: apply the filter while writing to and reading from the hash.
I recently upgreaded to
xcode 8.3.3 and ionic 3.4.0
I have removed ios-sim directory from myApp/platforms/ios/cordova/node_modules and now it's working.
in your project folder root, do
cd platforms/ios/cordova && npm install ios-sim
Another option is to use a
cordova-ios
version with theios-sim
patch already implementedcordova platform add https://github.com/apache/cordova-ios.git#4.4.0-ios-sim
Beware that this is not an official release of Apache Cordova, this will be included in next 4.4.1 version.
I have run following commands and it solves my problem:
cd project_dir
sudo npm install ios-sim@latest