C 1-PhoneGapの取り付け

4004 ワード

一、公式サイトのインストール手順(http://phonegap.com/install/)
InstallTo Install, ensure that you have NodeJS installed, then open your command-line and run the following:    $ sudo npm install -g phonegap        Once installation completes, you can invoke phonegap on command line for further help.
Usage    $ phonegap create my-app    $ cd my-app    $ phonegap run android     Learn more at docs.phonegap.com
 
二、補充
1、NodeJSインストール、(https://nodejs.org/)
2、npmの使用に失敗しました.解決策は以下の通りです(参考とお礼:https://cnodejs.org/topic/4f9904f9407edba21468f31e)
      ミラーの使用方法(3つの方法はいずれも問題を解決することができ、3つ目の方法を使用して、構成を書き込み、次回使用するときに構成することをお勧めします):
      1.configコマンドで
        npm config set registry https://registry.npm.taobao.org      npm info underscore response
      2.コマンドライン指定
 npm --registry https://registry.npm.taobao.org info underscore 

      3.編集~/.npmrcは以下の内容を加える
 registry = https://registry.npm.taobao.org

       ミラーの検索:https://npm.taobao.org
       ミラーの作成または使用、参照:https://github.com/cnpm/cnpmjs.org
 
三、PhoneGapのIOSプラットフォームでの応用
$ cordova create hello com.example.hello "HelloWorld"  
  • $ cd hello  

  • $ cordova platform add ios  
  • $ cordova prepare              # or "cordova build"

  • 公式サイトのリンクは:http://docs.phonegap.com/en/edge/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
     
    四、iOSプロジェクト内での使用例
    #import <Cordova/CDVViewController.h>  
    
    CDVViewController* viewController = [CDVViewController new];  
    
    viewController.wwwFolderName = @"myfolder";  
    
    viewController.startPage = @"mystartpage.html";  
    
    viewController.useSplashScreen = YES;  
    
    viewController.view.frame = CGRectMake(0, 0, 320, 480);  
    
    [myView addSubview:viewController.view]; 

    参考とお礼:
    http://blog.csdn.net/qs_csu/article/details/14160923