This is a migrated thread and some comments may be shown as answers.

Trouble with IOS Plugin

1 Answer 65 Views
iOS Devices
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan
Top achievements
Rank 1
Dan asked on 03 Dec 2013, 07:32 PM

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]);

 }
};

1 Answer, 1 is accepted

Sort by
0
Accepted
Dan
Top achievements
Rank 1
answered on 04 Dec 2013, 09:09 PM
Plugins do not work in Ion...
Plugins do not work in Ion...
Plugins do not work in Ion...
Plugins do not work in Ion...
Plugins do not work in Ion...
Plugins do not work in Ion...

On realizing this, I went through the app development process and am debugging on the device through iTunes.
Tags
iOS Devices
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Share this question
or