title: PhoneGap 3.0 iOS plugin
body: <p>I'm starting to write a PhoneGap plugin for iOS, but I'm having trouble calling even a simple <code>NSLog()</code> in my Objective C code through <code>cordova.exec()</code>. With the recent release of PhoneGap 3.0 and the possibly confusing PhoneGap/Cordova naming, it's difficult to find resources online that provide any examples that are up-to-date or working.</p>
  
  <p>Here is my barebones Objective C code:</p>
  
  <pre><code>// BLLog.h
  #import &lt;Cordova/CDV.h&gt;
  
  @interface BLLog : CDVPlugin
  
      - (void)log:(CDVInvokedUrlCommand *)command;
  
  @end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>#import "BLLog.h"
  
  @implementation BLLog
  
  - (void)log:(CDVInvokedUrlCommand *)command
  {
      NSLog(@"Hey, it works!");
  }
  
  @end
  </code></pre>
  
  <p>My html/javascript is pretty much the same as the code generated from a <code>phonegap create</code> with a few additions.</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
       ...
      &lt;/head&gt;
      &lt;body&gt;
          ...
          &lt;script type="text/javascript" src="phonegap.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              app.initialize();
              document.addEventListener('deviceready', function () {
                  app.log();
              }, false);
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This code contains the <code>cordova.exec()</code>:</p>
  
  <pre><code>var app = {
      ...
      log: function () {
          alert('log');
          cordova.exec(function (){ console.log('success') }, function () { console.log('error') },  'BLLog', 'log', []);
      }
  };
  </code></pre>
  
  <p>Here is my <code>config.xml</code>:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="com.metaio.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"&gt;
      &lt;name&gt;GapApp&lt;/name&gt;
      &lt;description&gt;
          Hello World sample application that responds to the deviceready event.
      &lt;/description&gt;
      &lt;author email="support@phonegap.com" href="http://phonegap.com"&gt;
          PhoneGap Team
      &lt;/author&gt;
      &lt;feature name="http://api.phonegap.com/1.0/device" /&gt;
      &lt;preference name="permissions" value="none" /&gt;
      &lt;preference name="orientation" value="default" /&gt;
      &lt;preference name="target-device" value="universal" /&gt;
      &lt;preference name="fullscreen" value="true" /&gt;
      &lt;preference name="webviewbounce" value="true" /&gt;
      &lt;preference name="prerendered-icon" value="true" /&gt;
      &lt;preference name="stay-in-webview" value="false" /&gt;
      &lt;preference name="ios-statusbarstyle" value="black-opaque" /&gt;
      &lt;preference name="detect-data-types" value="true" /&gt;
      &lt;preference name="exit-on-suspend" value="false" /&gt;
      &lt;preference name="show-splash-screen-spinner" value="true" /&gt;
      &lt;preference name="auto-hide-splash-screen" value="true" /&gt;
      &lt;preference name="disable-cursor" value="false" /&gt;
      &lt;preference name="android-minSdkVersion" value="7" /&gt;
      &lt;preference name="android-installLocation" value="auto" /&gt;
      &lt;icon src="icon.png" /&gt;
      &lt;icon gap:density="ldpi" gap:platform="android" src="res/icon/android/icon-36-ldpi.png" /&gt;
      &lt;icon gap:density="mdpi" gap:platform="android" src="res/icon/android/icon-48-mdpi.png" /&gt;
      &lt;icon gap:density="hdpi" gap:platform="android" src="res/icon/android/icon-72-hdpi.png" /&gt;
      &lt;icon gap:density="xhdpi" gap:platform="android" src="res/icon/android/icon-96-xhdpi.png" /&gt;
      &lt;icon gap:platform="blackberry" src="res/icon/blackberry/icon-80.png" /&gt;
      &lt;icon gap:platform="blackberry" gap:state="hover" src="res/icon/blackberry/icon-80.png" /&gt;
      &lt;icon gap:platform="ios" height="57" src="res/icon/ios/icon-57.png" width="57" /&gt;
      &lt;icon gap:platform="ios" height="72" src="res/icon/ios/icon-72.png" width="72" /&gt;
      &lt;icon gap:platform="ios" height="114" src="res/icon/ios/icon-57-2x.png" width="114" /&gt;
      &lt;icon gap:platform="ios" height="144" src="res/icon/ios/icon-72-2x.png" width="144" /&gt;
      &lt;icon gap:platform="webos" src="res/icon/webos/icon-64.png" /&gt;
      &lt;icon gap:platform="winphone" src="res/icon/windows-phone/icon-48.png" /&gt;
      &lt;icon gap:platform="winphone" gap:role="background" src="res/icon/windows-phone/icon-173.png" /&gt;
      &lt;gap:splash gap:density="ldpi" gap:platform="android" src="res/screen/android/screen-ldpi-portrait.png" /&gt;
      &lt;gap:splash gap:density="mdpi" gap:platform="android" src="res/screen/android/screen-mdpi-portrait.png" /&gt;
      &lt;gap:splash gap:density="hdpi" gap:platform="android" src="res/screen/android/screen-hdpi-portrait.png" /&gt;
      &lt;gap:splash gap:density="xhdpi" gap:platform="android" src="res/screen/android/screen-xhdpi-portrait.png" /&gt;
      &lt;gap:splash gap:platform="blackberry" src="res/screen/blackberry/screen-225.png" /&gt;
      &lt;gap:splash gap:platform="ios" height="480" src="res/screen/ios/screen-iphone-portrait.png" width="320" /&gt;
      &lt;gap:splash gap:platform="ios" height="960" src="res/screen/ios/screen-iphone-portrait-2x.png" width="640" /&gt;
      &lt;gap:splash gap:platform="ios" height="1024" src="res/screen/ios/screen-ipad-portrait.png" width="768" /&gt;
      &lt;gap:splash gap:platform="ios" height="768" src="res/screen/ios/screen-ipad-landscape.png" width="1024" /&gt;
      &lt;gap:splash gap:platform="winphone" src="res/screen/windows-phone/screen-portrait.jpg" /&gt;
  
      &lt;feature name="BLLog" onload="true"&gt;
          &lt;param name="ios-package" value="BLLog" /&gt;
      &lt;/feature&gt;
  
      &lt;access origin="http://127.0.0.1*" /&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p>I also tried replacing the <code>&lt;feature&gt;</code> tags with <code>&lt;plugin name="BLLog" value ="BLLog" \&gt;</code>, but that didn't work either.</p>
  
  <p>Finally, here is the XCode output:</p>
  
  <pre><code>2013-07-30 11:36:40.810 GapApp[407:907] ERROR: Plugin 'BLLog' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
  2013-07-30 11:36:40.812 GapApp[407:907] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
    "BLLog870927167",
    "BLLog",
    "log",
    [
  
    ]
  ]
  </code></pre>