我有一个iOS objective-c组件,应该包含在PhoneGap/Cordova插件中.
这是我在plugin.xml文件中的一部分:
<platform name="ios">
...
<resource-file src="src/ios/TGCameraViewController/View/Base.lproj/TGCameraAuthorizationViewController.xib" target-dir="TGCameraViewController/View/Base.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/Base.lproj/TGCameraViewController.xib" target-dir="TGCameraViewController/View/Base.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/Base.lproj/TGPhotoViewController.xib" target-dir="TGCameraViewController/View/Base.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/de.lproj/TGCameraAuthorizationViewController.strings" target-dir="TGCameraViewController/View/de.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/de.lproj/TGCameraViewController.strings" target-dir="TGCameraViewController/View/de.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/de.lproj/TGPhotoViewController.strings" target-dir="TGCameraViewController/View/de.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/pt-BR.lproj/TGCameraAuthorizationViewController.strings" target-dir="TGCameraViewController/View/pt-BR.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/pt-BR.lproj/TGCameraViewController.strings" target-dir="TGCameraViewController/View/pt-BR.lproj" />
<resource-file src="src/ios/TGCameraViewController/View/pt-BR.lproj/TGPhotoViewController.strings" target-dir="TGCameraViewController/View/pt-BR.lproj" />
</platform>
Run Code Online (Sandbox Code Playgroud)
当我尝试将插件添加到我的应用程序时,我收到以下错误:
Failed to install 'org.test.cordova.TestPlugin':Error: Uh oh!
target destination "/Users/mg/Documents/iOS/hello/platforms/ios/HelloWorld/Resources/TGCameraAuthorizationViewController.strings" already exists
at module.exports.resource-file.install (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/platforms/ios.js:128:48)
at Object.ActionStack.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/action-stack.js:72:25)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:591:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:340:28
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:509:49
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17) …Run Code Online (Sandbox Code Playgroud) 我正在为 Android 编写自己的 cordova 插件。我的插件在一个独立的 Android 项目中工作。我似乎无法从插件 java 文件开始我的活动。它不断触发找不到 MainActivity(找不到符号)的错误。我希望这是一个我似乎错过的简单修复。
安卓清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.testplugin" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustResize"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
Run Code Online (Sandbox Code Playgroud)
插件Java:
package com.myapp.testplugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaInterface;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.provider.Settings;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class TestPlugin extends CordovaPlugin {
public static final …Run Code Online (Sandbox Code Playgroud) 我被困在同一个问题2天:(
我有两个Ionic-PhoneGap应用程序需要能够相互打开,不是在WebView外部,而是在外部(如果应用程序已经运行,它可以重新启动或只是继续 - 我将处理两者).
经过几个小时的研究,我发现,使用InAppBrowser (window.open(URL, _system)),我能够在外部打开我尝试的每个商业应用程序(Facebook,推特,地图等).尝试打开我的某个应用程序时,同一个调用会在Web视图中打开它.
window.open("fb://", _system) -> opens Facebook separately.
window.open("myapp://", _system) -> opens my application in a web view.
Run Code Online (Sandbox Code Playgroud)
我试图修改AndroidManifest.xml和config.xml,但几乎我改变的一切都被建筑物抹去了.
例如,如果我"android:launchMode="singleTop"改为"android:launchMode="singleTask"并运行"Ionic build",我的更改就会丢失.
有解决方案吗
在我的离子 Cordova 应用程序中,我使用应用内购买插件:https : //github.com/j3k0/cordova-plugin-purchase
这是我用来初始化存储的方法:
storekit.init({
debug: true, // Enable IAP messages on the console
ready: service.IAP.onReady,
purchase: service.IAP.onPurchase,
restore: service.IAP.onRestore,
error: service.IAP.onError
});
Run Code Online (Sandbox Code Playgroud)
此初始化在 iOS 上运行良好,所有产品也可以正常加载,但 Android 设备在购买时无法加载。
我猜,对于 android 有不同的初始化方法。
我在应用程序中添加了插件:
cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="<BILLING_KEY>"
Run Code Online (Sandbox Code Playgroud)
请帮忙。
我想使用phonegap nfc读取nfc卡(教程phonegap)但该事件未启动
这是index.js的代码
onDeviceReady: function() {
app.receivedEvent('deviceready');
// Read NDEF formatted NFC Tags
nfc.addNdefListener (
function (nfcEvent) {
var tag = nfcEvent.tag,
ndefMessage = tag.ndefMessage;
// dump the raw json of the message
// note: real code will need to decode
// the payload from each record
alert(JSON.stringify(ndefMessage));
// assuming the first record in the message has
// a payload that can be converted to a string.
alert(nfc.bytesToString(ndefMessage[0].payload).substring(3));
},
function () { // success callback
alert("Waiting for NDEF …Run Code Online (Sandbox Code Playgroud) 我已经使用 Cordova/Phonegap 和 Web 技术开发了一个应用程序,并想对其进行一些个性化设置,但我找不到方法。
在 android 中,当用户按下概览按钮(方形按钮)时,他们可以看到每个打开的应用程序的带有卡片的概述,这些卡片有一个带有图标和应用程序名称的顶部栏。如此屏幕截图所示:

默认情况下,条形颜色为灰色,但我希望它是一种不同的颜色,以更好地匹配我的应用程序中的颜色。这可以在其他应用程序中看到,该栏具有不同的颜色(例如:Chrome 栏为蓝色,电子邮件栏为橙色等):

我尝试使用theme-color元值,但这没有做任何事情。我还尝试了状态栏插件,这个插件在应用程序打开时更改了状态栏,但在概览卡模式下仍然显示默认的灰色栏。
是否可以使用 Cordova/Phonegap 自定义此概览栏颜色?怎么做?
我创建了一个简单的cordova android应用程序,我试图从一个URL下载一个图像到图片库,但我真的不知道出了什么问题。我已经在 stackoverflow 中搜索了很多,包括以下链接:
如何使用Phonegap将Image对象保存到Android中的文件中?
我已经安装了cordova File Transfer插件并尝试从官方网站上做示例,但它也不起作用:https : //cordova.apache.org/docs/en/latest/reference/cordova-plugin-file-转移/
我尝试了 2 种不同的代码,它们是:
1)第一次尝试:
document.getElementById("myBtn").addEventListener("click", function () {
download("http://cordova.apache.org/static/img/cordova_bot.png", "data", "new_file");
});
function download(URL, Folder_Name, File_Name) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fileSystemSuccess, fileSystemFail);
function fileSystemSuccess(fileSystem) {
var download_link = encodeURI(URL);
ext = download_link.substr(download_link.lastIndexOf('.') + 1); //Get extension of URL
var directoryEntry = fileSystem.root; // to get root path of directory
directoryEntry.getDirectory(Folder_Name, {
create: true,
exclusive: false
}, onDirectorySuccess, onDirectoryFail); // creating folder in sdcard
var rootdir …Run Code Online (Sandbox Code Playgroud) 是否可以使用自定义屏幕替换iOS和Android的启动画面?
据我所知,iOS PhoneGap中有2个闪屏:
是否有可能:
似乎正常的xCode做事方式被覆盖了.我有点困惑,因为我是PhoneGap的新手.
我陷入了这个phonegap项目.在Android和iOS <= 7上,一切都很完美,但在iOS> = 8.0时失败.将出现一个弹出窗口,其中显示消息:"找不到变量:device"

这是我得到的消息:
这是我的HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<script type="text/javascript" src="cordova.js" charset="utf-8"></script>
<script type="text/javascript" src="js/PushNotification.js" charset="utf-8"></script>
</head>
<body onload="documentReady();">
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
这是我在标签底部加载的'index.js'.
var myPushNotification;
// result …Run Code Online (Sandbox Code Playgroud)phonegap-plugins cordova phonegap-build phonegap-pushplugin ios8
我正在按照下面的GitHub拉取请求来查看是否可行,在代码更改意义上有一些活动(17行),但我不确定如何将其实现到我的iOS应用程序中...有人有任何想法吗?(科尔多瓦5.1)
https://github.com/apache/cordova-plu ...
干杯,威尔
cordova ×10
phonegap-plugins ×10
android ×6
ios ×3
javascript ×3
angularjs ×2
ionic ×2
github ×1
html ×1
inappbrowser ×1
ios8 ×1
objective-c ×1
user-agent ×1
xcode ×1