Cordova Quick Start record

Source: Internet
Author: User



This post consists of: http://xinpure.com/cordova-quick-start-recording/


Write a pen.


Cordova official website Getting started document Get Started Fast, simple meaning, easy to understand.



Just record the process and installation of the problems encountered, do a souvenir or something.


Start using


It's all about the official documents, knocking on orders.


Installing Cordova
xinpureZhu:cordova xinpure$ sudo npm install -g cordova
Create a project
xinpureZhu:cordova xinpure$ cordova create MyAppCreating a new cordova project.
Add platform Support


Cordova is now supported by the platform,,,,,,amazon-fireosandroidblackberry10browserfirefoxosiososx,webos



Here, with the documentation, you have selectedbrowser


xinpureZhu:cordova xinpure$ cd MyApp/

xinpureZhu:MyApp xinpure$ ls

config.xml  hooks       platforms   plugins     www

xinpureZhu:MyApp xinpure$ cordova platform

Installed platforms:

Available platforms: amazon-fireos, android, blackberry10, browser, firefoxos, ios, osx, webos

xinpureZhu:MyApp xinpure$ cordova platform add browser

Adding browser project...

Creating Browser project. Path: platforms/browser

Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project

Fetching plugin "[email protected]" via npm

Installing "cordova-plugin-whitelist" for browser
Launch APP
xinpureZhu:MyApp xinpure$ cordova run browser

Running command: /Project/cordova/MyApp/platforms/browser/cordova/run

Static file server running on port 8000 (i.e. http://localhost:8000)

CTRL + C to shut down

Static file server running @ http://localhost:8000/index.html

CTRL + C to shut down

Executing command: open -n -a "Google Chrome" --args --user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova http://localhost:8000/index.html


Here, the Cordova Quick Start is over, and it's quite simple.


Add iOS platform support for your project


WebApp of course still want to run on the mobile phone to be in place, here useiostaste fresh


Add an iOS platform to your project
xinpureZhu:MyApp xinpure$ cordova platform add ios

Adding ios project...

iOS project created with [email protected]

Installing "cordova-plugin-whitelist" for ios
Launch the app on a new platform
xinpureZhu:MyApp xinpure$ cordova run ios

Running command: /Project/cordova/MyApp/platforms/ios/cordova/run

ios-sim was not found. Please download, build and install version 3.0.0 or greater from https://github.com/phonegap/ios-sim into your path, or do ‘npm install -g ios-sim‘

ERROR running one or more of the platforms: Error: /Project/cordova/MyApp/platforms/ios/cordova/run: Command failed with exit code 2

You may not have the required environment or OS to run this project


The execution command finally is not so smooth, the lackios-simof modules (the solution has been clearly prompted, so it is not a problem)



Follow the prompts to execute the command:


xinpureZhu:MyApp xinpure$ sudo npm install -g ios-sim


After the installation is complete and then re-execute the startup command:


xinpureZhu:MyApp xinpure$ cordova run ios

Running command: /Project/cordova/MyApp/platforms/ios/cordova/run

simctl was not found.

Check that you have Xcode 6.x installed:

    xcodebuild --versionCheck that you have Xcode 6.x selected:
    xcode-select --print-path

ERROR running one or more of the platforms: Error: /Project/cordova/MyApp/platforms/ios/cordova/run: Command failed with exit code 2

You may not have the required environment or OS to run this project


Well, seeing this error, my heart is dazed.



I am using Mac OS X EI Capitan, and Xcode has been updated to 7.0.1, why?



After viewing the document againbowser, it is different from the platform and theiosplatform needs to firstbuild



In fact, I have seen this before, but the mindset is assumed tobuildcordova runbe executed at the same time, but itcordova buildis not.


Build App
xinpureZhu: MyApp xinpure$ cordova platform ls

Installed platforms: browser 4.0.0, ios 3.9.1

Available platforms: amazon-fireos, android, blackberry10, firefoxos, osx, webos

xinpureZhu: MyApp xinpure$ cordova build ios

...omitting a series of Build messages here:

** BUILD SUCCEEDED ** 


Apparently, itSUCCEEDED's already done.


Launch the APP using the emulator
xinpureZhu:MyApp xinpure$ cordova emulate ios


This still omits a lot of compile information at startup. Boot success will alsoSUCCEEDEDprompt, and the Xcode emulator will launch and open the APP


Summarize


Although the official has provided the detailed documentation, the document is also easy to understand, but no matter how simple or to personally knock on the command, there might be some unexpected problems.



Cordova Quick Start record


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.