I am trying to get an IOS plugin to work. I have broken it down to its most basic form (start, do nothing, perform call back).
However, the call back is not being called. Please don't direct me to the Cordova plugin documentation. Been there, done that... I am using Icenium Graphite against Cordova 3.0.
plugin.xml...
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.custom.plugin.ExtractZipFile"
version="0.1.0">
<name>ExtractZipFile</name>
<asset src="www/ExtractZipFile.js" target="ExtractZipFile.js" />
<!-- android -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.custom.plugin.ExtractZipFilePlugin.ExtractZipFile"
android:label="@string/app_name">
<intent-filter></intent-filter>
</activity>
</config-file>
<config-file target="res/xml/config.xml" parent="widget">
<feature name="ExtractZipFile">
<param name="android-package" value="com.custom.plugin.ExtractZipFilePlugin.ExtractZipFile" />
</feature>
</config-file>
<source-file src="src/android/com/custom/plugin/ExtractZipFile.java" target-dir="src/com/custom/plugin" />
</platform>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="ExtractZipFile">
<param name="ios-package" value="ExtractZipFile" />
</feature>
</config-file>
<header-file src="src/ios/ExtractZipFile.h" />
<source-file src="src/ios/ExtractZipFile.m" />
</platform>
</plugin>
//
// ExtractZipFile.m
//
#import "ExtractZipFile.h"
#import <Cordova/CDV.h>
@implementation ExtractZipFile
- (void)extract:(CDVInvokedUrlCommand*)command
{
CDVPluginResult *pluginResult = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Could not extract archive"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
//
// ExtractZipFile.h
//
#import <Cordova/CDV.h>
@interface ExtractZipFile : CDVPlugin
- (void)extract:(CDVInvokedUrlCommand*)command;
@end
/**
* ZipPlugin.js
*
var ExtractZipFilePlugin = function(){
}
cordova.addConstructor(function(){
if(!window.plugins) window.plugins = {};
window.plugins.extractZipFile = new ExtractZipFilePlugin();
});
ExtractZipFilePlugin.prototype.extractFile = function(file, successCallback, errorCallback, destination )
{
if (device.platform === "Android") {
//Android
cordova.exec(successCallback, errorCallback, "ExtractZipFile", "unzip", [file]);
} else {
//ios
cordova.exec(function(message){alert('zipWin:' + message)}, function(message){alert('zipFail: ' + message)}, "ExtractZipFile", "extract", [file, destination]);
}
};