【问题标题】:Phonegap plugins with ripple emulator带有波纹模拟器的 Phonegap 插件
【发布时间】:2014-04-17 10:26:10
【问题描述】:

我想在我的 phonegap 应用中使用 couchbase lite。它是一个 phonegap 插件,但是当我尝试在涟漪中使用它时,我得到:

CBLite.getURL

We seem to be missing some stuff :(

是否可以使用插件或者我是否使用其他模拟器? (呜咽)

【问题讨论】:

    标签: cordova couchbase ripple couchbase-lite


    【解决方案1】:

    如果您使用基于浏览器的(Chrome 扩展程序)Ripple,请尝试使用 Android 模拟器或 GenyMotion 而不是 Ripple。

    Couchbase Lite 插件提供了一个 URL。您可以在执行 CRUD 操作时使用此 URL。

    要在 Cordova(PhoneGap) 上进行快速开发,请尝试以下文章。

    • 您可以使用c:\APP_FOLDER> cordova build 构建您的代码
    • 您可以使用 c:\APP_FOLDER> adb devices 为 ADB 添加您的模拟器 - 只需一次 - 当您的模拟器运行时
    • 您可以使用adb install -r "platforms\android\ant-build\CordovaApp-debug.apk" 将模拟器上的应用替换为新制造的应用

    您必须在onDeviceReady 活动中编写代码。

    警告(2014/11/18 之前): 如果您使用 cordova plugin add com.couchbase.lite.phonegap 导入了 Cordova Couchbase Lite 插件,那么您正在尝试使用 beta 版本的插件。必须使用cordova plugin add https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git 删除并重新导入

    希望对您有所帮助!

    var couchbaseLiteURL = "";
    var databaseName = "test";
    
    if(window.cblite) {
         window.cblite.getURL(function(err, url) {
                if(err) {
                    console.log("error launching Couchbase Lite: " + err);
                } else {
                    console.log("Couchbase Lite running at " + url);
                    couchbaseLiteURL = url;
                }
         });
    
    } else {
         console.log("error, Couchbase Lite plugin not found.");
    }
    
    //jQuery Ajax function
    $.ajax(
         url: couchbaseLiteURL + databaseName,
         type: PUT,
         success: function (data, textStatus, xhr) {
              // You can see console output from Chrome Inspect tool chrome://inspect/#devices
              // xhr.status returns a code to you. 
              console.log("success! with status: " + xhr.status); 
         },
         error: function (xhr, statusText, errorThrown) {
              console.log(JSON.stringify(xhr));
         }
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-04
      相关资源
      最近更新 更多