title: PhoneGap plugin: AudioEncode success callback never called
body: <p>I'm using the AudioEncode plugin for PhoneGap (Cordova) on iOS. After updating a couple of lines for a newer version of Cordova, it appears to be correctly encoding wav files as m4a. In the Xcode console I see:</p>
  
  <pre><code>AVAssetExportSessionStatusCompleted
  doing success callback
  </code></pre>
  
  <p>When I look at the file system on the phone, the wav file has indeed become a m4a. However, the success callback (where I upload the file to a server) is never run. This is the relevant code in the plugin:</p>
  
  <pre><code>-(void) doSuccessCallback:(NSString*)path {
      NSLog(@"doing success callback");
      NSString* jsCallback = [NSString stringWithFormat:@"%@(\"%@\");", self.successCallback, path];
      [self writeJavascript: jsCallback];
      [self.successCallback release];
  }
  </code></pre>
  
  <p>My code in the app goes like this:</p>
  
  <pre><code>function encodeSuccess (path) {
      console.log('Audio encoded to M4A! Preparing to upload...')
      // file transfer code...
  }
  
  console.log('Preparing to encode audio file...')
  window.plugins.AudioEncode.encodeAudio(entry.fullPath, encodeSuccess, fail)
  </code></pre>
  
  <p>I'm assuming the <code>doSuccessCallback</code> function in the plugin needs to be updated, but I don't have experience with Objective C or PhoneGap plugins, so I'm stuck at this point. </p>
  
  <p>Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>In the Objective C function posted above, I tried logging <code>self.successCallback</code>, and it logged as <code>&lt;null&gt;</code>. Then I went up to the top of the main <code>encodeAudio</code> function, and the argument which is assigned to <code>self.successCallback</code> (<code>[arguments objectAtIndex:1]</code>) also logs as <code>&lt;null&gt;</code>. So, it seems to me that the callbacks are not being passed into the main function successfully. </p>
  
  <p>This is the AudioEncode.h file, maybe someone can spot the problem here:</p>
  
  <pre><code>@interface AudioEncode : CDVPlugin {
      NSString* successCallback;
      NSString* failCallback;
  }
  
  @property (nonatomic, retain) NSString* successCallback;
  @property (nonatomic, retain) NSString* failCallback;
  
  - (void)encodeAudio:(NSArray*)arguments withDict:(NSDictionary*)options;
  </code></pre>