<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ZenBrains &#187; iphone</title>
	<atom:link href="http://www.zenbrains.com/blog/en/tag/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zenbrains.com/blog</link>
	<description>IPhone Development Team</description>
	<lastBuildDate>Tue, 17 May 2011 21:06:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>(Español) Test de velocidad entre las 4 generaciones de iPhone</title>
		<link>http://www.zenbrains.com/blog/en/2010/07/test-de-velocidad-entre-las-4-generaciones-de-iphone/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/07/test-de-velocidad-entre-las-4-generaciones-de-iphone/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 17:47:43 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Novedades]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=621</guid>
		<description><![CDATA[Sorry, this entry is only available in Español.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F07%2Ftest-de-velocidad-entre-las-4-generaciones-de-iphone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F07%2Ftest-de-velocidad-entre-las-4-generaciones-de-iphone%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Sorry, this entry is only available in <a href="http://www.zenbrains.com/blog/tag/iphone/feed/">Español</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/07/test-de-velocidad-entre-las-4-generaciones-de-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WWDC 2010</title>
		<link>http://www.zenbrains.com/blog/en/2010/06/wwdc-2010/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/06/wwdc-2010/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 08:38:56 +0000</pubDate>
		<dc:creator>Marcos</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Novedades]]></category>
		<category><![CDATA[anuncios]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=462</guid>
		<description><![CDATA[Tomorrow at 10AM PST, 7PM Spanish time, starts the Apple Worldwide Developer Conference, at Moscone West in San Francisco, California and will last until Friday 11th. It is expected with great enthusiasm because all of the new things that are expected to be presented, one of them the official iPhone 4.0, although it was earlier [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F06%2Fwwdc-2010%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F06%2Fwwdc-2010%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Tomorrow at 10AM PST, 7PM Spanish time, starts the Apple Worldwide Developer Conference, at Moscone West in San Francisco, California and will last until Friday 11th. It is expected with great enthusiasm because all of the new things that are expected to be presented, one of them the official iPhone 4.0, although it was earlier presented by <a href="http://gizmodo.com/">Gizmodo</a>, they paid 5.000$ for a supposed <a href="http://gizmodo.com/5520164/this-is-apples-next-iphone">iPhone 4.0</a> found in a bar and that at the end Apple reclaim as their own, it&#8217;s still generating rumors. Will there be some modifications to the model shown or will it be the real iPhone 4.0?</p>
<p>Not only the phone will be presented but other many things might see the light:</p>
<ul>
<li>iPhone OS 4.0.</li>
<li>Apple TV.</li>
<li>Mac OS X 10.6.4.</li>
<li>Safari 5</li>
<li>Versión gratis del MobileMe</li>
</ul>
<p>The venue can be followed  in many blogs and we hope there will be too some live streaming. Here there are some places where might be posible to follow it.<br />
<strong><br />
Blogs</strong><br />
<a target="_blank" href="http://live.gdgt.com/">GDGT Live</a><br />
<a target="_blank" href="http://live.gizmodo.com">Gizmodo</a><br />
<a target="_blank" href="http://macrumorslive.com">MacRumors Live</a><br />
<a target="_blank" href="http://theappleblog.com/live/">The Apple Blog</a><br />
<a target="_blank" href="http://news.cnet.com/apple/?keyword=live+blog&amp;tag=mncol;tags">CNET Live</a></p>
<p><strong>Streams</strong><br />
 <a target="_blank" href="http://www.livestream.com/crunchgear">Watch Apple WWDC 2010 event live online on CrunchGear</a><br />
<a target="_blank" href="http://live.twit.tv/">Watch WWDC 2010 live streaming on Twit Live TV</a><br />
<a target="_blank" href="http://livetechevents.com/">Watch 2010 WWDC iPhone HD event on LiveTechEvents</a></p>
<p><em>Information obtained from various places in the Internet.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/06/wwdc-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Español) Mostrar la vista &#8220;About&#8221; o &#8220;Acerca de&#8221; con la típica animación</title>
		<link>http://www.zenbrains.com/blog/en/2010/05/mostrar-la-vista-about-o-acerca-de-con-la-tipica-animacion/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/05/mostrar-la-vista-about-o-acerca-de-con-la-tipica-animacion/#comments</comments>
		<pubDate>Sun, 23 May 2010 17:01:12 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=411</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2Fmostrar-la-vista-about-o-acerca-de-con-la-tipica-animacion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2Fmostrar-la-vista-about-o-acerca-de-con-la-tipica-animacion%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/05/mostrar-la-vista-about-o-acerca-de-con-la-tipica-animacion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sound in buttons</title>
		<link>http://www.zenbrains.com/blog/en/2010/05/sonido-en-botones/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/05/sonido-en-botones/#comments</comments>
		<pubDate>Sun, 16 May 2010 20:10:54 +0000</pubDate>
		<dc:creator>Marcos</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[sonidos]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=360</guid>
		<description><![CDATA[Today I will explain how we can play a sound when a button is pressed, in fact, what I will explain can be used in many other situations and not only for buttons, because what I will do is to create a SystemSoundID which is used, among another things, to play short (30 seconds or [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2Fsonido-en-botones%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2Fsonido-en-botones%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Today I will explain how we can play a sound when a button is pressed, in fact, what I will explain can be used in many other situations and not only for buttons, because what I will do is to create a <strong><em><a href="http://developer.apple.com/iphone/library/documentation/AudioToolbox/Reference/SystemSoundServicesReference/Reference/reference.html">SystemSoundID</a></em></strong> which is used, among another things, to play short (30 seconds or less) sounds. But as an example, I will use a button.</p>
<p>To be able to reproduce sounds we will need to add the <strong>AudioToolbox</strong> Framework to our project.</p>
<p>Imagine we have a <em>UIViewController</em> and the view it is controlling, add a <em>UIButton</em> to the view using Interface Builder or do it programmatically, as you like most. If you haven&#8217;t added yet the Framework to the project, do it now, once you have done it we have to import it to our view controller.</p>
<p>In the header file (.h) of our controller add a variable of type <em>SystemSoundID</em> and a method which will be called when the button is pressed.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span>
<span style="color: #6e371a;">#import &lt;AudioToolbox/AudioToolbox.h&gt;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> testKeyboardViewController <span style="color: #002200;">:</span> UIViewController &lt;UITextFieldDelegate&gt; <span style="color: #002200;">&#123;</span>
&nbsp;
	SystemSoundID buttonSoundID;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span>buttonPressed;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Now we need a sound file, with the sound we want, for example call it ButtonSound.caf, now, and in the viewDidLoad of our controller add the following lines to create the reference to our sound.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>path <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;ButtonSound&quot;</span> ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;caf&quot;</span><span style="color: #002200;">&#93;</span>;
	AudioServicesCreateSystemSoundID<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>CFURLRef<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> fileURLWithPath<span style="color: #002200;">:</span>path<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&amp;</span>buttonSoundID<span style="color: #002200;">&#41;</span>;	
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>As you can see in the code, we need the path for our file, if you have add the file to your group Resources in Xcode, the code above should work for you. Take a look at <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html">NSBundle</a> if that doesn&#8217;t work to look for another method that allows you to find the path to the file.</p>
<p>With this we have the reference to the sound, now we only need to play it when we need, in this case, we want to play it when the button is pressed. Add to the method that is called when the button is pressed, the following lines</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>IBAction<span style="color: #002200;">&#41;</span>buttonPressed <span style="color: #002200;">&#123;</span>	
	AudioServicesPlaySystemSound<span style="color: #002200;">&#40;</span>buttonSoundID<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Now you should be hearing the sound when you press the button.</p>
<p>When you don&#8217;t need anymore the sound, you can use the following function to remove the reference, for example in the viewDidUnload of our controller.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidUnload <span style="color: #002200;">&#123;</span>
	AudioServicesDisposeSystemSoundID<span style="color: #002200;">&#40;</span>buttonSoundID<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>I hope that this post is useful and now you are able to add all kind of short sounds to your application to give it a bit more of life.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/05/sonido-en-botones/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>¿Cómo mostrar imágenes (CSS, scripts y más) en UIWebView?</title>
		<link>http://www.zenbrains.com/blog/en/2010/05/%c2%bfcomo-mostrar-imagenes-css-scripts-y-mas-en-uiwebview/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/05/%c2%bfcomo-mostrar-imagenes-css-scripts-y-mas-en-uiwebview/#comments</comments>
		<pubDate>Wed, 05 May 2010 16:50:41 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[uiwebview]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=270</guid>
		<description><![CDATA[Es una de las preguntas más frecuentes en los foros de programación iPhone. Por qué cuando ponemos &#60;img src=&#8221;miFoto.jpg&#8221; /&#62; no sale nada si tenemos miFoto.jpg entre nuestros ficheros de recursos añadidos en XCode? Supongamos que el código que usamos para cargar el html del nuestro UIWebView es el siguiente: NSString *html = @&#34;&#60;html&#62;&#60;body&#62;&#60;img src='miFoto.jpg' [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2F%25c2%25bfcomo-mostrar-imagenes-css-scripts-y-mas-en-uiwebview%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F05%2F%25c2%25bfcomo-mostrar-imagenes-css-scripts-y-mas-en-uiwebview%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Es una de las preguntas más frecuentes en los foros de programación iPhone.</p>
<p>Por qué cuando ponemos &lt;img src=&#8221;miFoto.jpg&#8221; /&gt; no sale nada si tenemos miFoto.jpg entre nuestros ficheros de recursos añadidos en XCode?</p>
<p>Supongamos que el código que usamos para cargar el html del nuestro UIWebView es el siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>html <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;html&gt;&lt;body&gt;&lt;img src='miFoto.jpg' /&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span>;
<span style="color: #002200;">&#91;</span>miUIWebView loadHTMLString<span style="color: #002200;">:</span>html baseURL<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Con esto vemos que no se muestra ninguna imagen. El problema está en que UIWebView no sabe donde buscar la foto. Nosotros le hemos dicho la foto que queremos pero no hemos dicho donde tiene que buscarlo, para eso tenemos el parámetro baseURL.</p>
<p>Nuestra imagen está entre nuestros ficheros de recursos por lo que la UIWebView tiene que ir a buscar la imagen entre los ficheros de recursos y para eso tenemos que pasar el path de la carpeta de recursos vía el parámetro baseURL.</p>
<p>Entonces, la versión correcta del código sería el siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>path <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> fileURLWithPath<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> bundlePath<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>html <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;html&gt;&lt;body&gt;&lt;img src='miFoto.jpg' /&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span>;
<span style="color: #002200;">&#91;</span>miUIWebView loadHTMLString<span style="color: #002200;">:</span>html baseURL<span style="color: #002200;">:</span>path<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Y todo esto que se ha explicado también es válido en el caso de que queramos incluir scripts externos o ficheros CSS.</p>
<p>Sorprendentemente hay gente que no conoce esta solución tan simple y <a href="http://iphoneincubator.com/blog/windows-views/display-images-in-uiwebview">hacen &#8220;cosas raras&#8221;</a> sólo para poder mostrar fotos.</p>
<p>Una forma poco común de mostrar imágenes es convertirlos a base64 y usar la <a href="http://es.wikipedia.org/wiki/Data:_URL">esquema data:URI</a> para mostrarlos en una página web.</p>
<p>Ejemplo:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;img src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoA
AAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQ
AAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0S
U1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3Jl
YXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL
0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7
jqch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6M
Jpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==&quot; alt=&quot;Red dot&quot; /&gt;</pre></div></div>

<p>Esto en la mayoría de los casos no se usa pero también tiene su utilidad en diferentes entornos. Por ejemplo antes de la versión 3.0 de iPhone OS no podíamos adjuntar imágenes a los emails desde nuestro código y muchos lo solucionaron parcialmente pasando la imagen como texto (en base 64).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/05/%c2%bfcomo-mostrar-imagenes-css-scripts-y-mas-en-uiwebview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programar el GPS del iPhone para obtener las coordenadas del dispositivo</title>
		<link>http://www.zenbrains.com/blog/en/2010/04/programar-el-gps-del-iphone-para-obtener-las-coordenadas-del-dispositivo/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/04/programar-el-gps-del-iphone-para-obtener-las-coordenadas-del-dispositivo/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:28:17 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=206</guid>
		<description><![CDATA[En este arículo/tutorial vamos a ver en detalle cómo obtener la posición GPS del iPhone, que problemas podemos tener durante la obtención de las coordenadas y cómo podemos solucionar estos problemas. Primero de todo si queremos usar el GPS en nuestras aplicaciones tenemos que añadir el CoreLocation a nuestro proyecto. Para eso hacemos click derecho [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2Fprogramar-el-gps-del-iphone-para-obtener-las-coordenadas-del-dispositivo%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2Fprogramar-el-gps-del-iphone-para-obtener-las-coordenadas-del-dispositivo%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>En este arículo/tutorial vamos a ver en detalle cómo obtener la posición GPS del iPhone, que problemas podemos tener durante la obtención de las coordenadas y cómo podemos solucionar estos problemas.</p>
<p>Primero de todo si queremos usar el GPS en nuestras aplicaciones tenemos que añadir el CoreLocation a nuestro proyecto. Para eso hacemos click derecho en el grupo &#8220;Frameworks&#8221; del nuestro proyecto y seleccionamos &#8220;Add &gt; Existing Frameworks&#8230;&#8221;.</p>
<p><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-12.png"><img class="alignnone size-full wp-image-207" title="Picture 1" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-12.png" alt="" width="496" height="285" /></a></p>
<p>Esto nos abrirá la ventana para seleccionar el framework a añadir. Buscamos el &#8220;CoreLocation.framework&#8221; y lo añadimos al proyecto.</p>
<p><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-22.png"><img class="alignnone size-full wp-image-208" title="Picture 2" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-22.png" alt="" width="567" height="375" /></a></p>
<p>Con esto tenemos todo configurado para empezar a picar código que use el GPS.</p>
<p>En nuestro código tenemos que incluir las cabeceras de las funciones GPS:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;CoreLocation/CoreLocation.h&gt;</span>
<span style="color: #6e371a;">#import &lt;CoreLocation/CLLocationManagerDelegate.h&gt;</span></pre></div></div>

<p>asdad&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Para obtener las coordenadas tenemos que usar el &#8220;<a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html">CLLocationManager</a>&#8221; e implementar el protocolo &#8220;<a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html">CLLocationManagerDelegate</a>&#8220;.</p>
<p>El CLLocationManager se inicializaría así:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">CLLocationManager <span style="color: #002200;">*</span>gpsManager <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>CLLocationManager alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>gpsManager setDelegate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>gpsManager setDesiredAccuracy<span style="color: #002200;">:</span>kCLLocationAccuracyBest<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>gpsManager startUpdatingLocation<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Con startUpdatingLocation decimos al location manager que empiece a leer del dispositivo GPS.</p>
<p>Ahora veamos los métodos del protocolo a implementar. Nuestro gpsManager llamará a estos métodos cuando obtenga coordenadas nuevas.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Se llama cada vez que hay una nueva coordenada</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>locationManager<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocationManager <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>manager didUpdateToLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>newLocation fromLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>oldLocation<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">//Hacer algo con newLocation (mostrar la posición en el mapa o lo que sea</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//Se llama cuando se produce algún error en la obtención de datos GPS</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>locationManager<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocationManager <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>manager didFailWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSError</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error <span style="color: #002200;">&#123;</span>
   <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>error code<span style="color: #002200;">&#93;</span><span style="color: #002200;">==</span>kCLErrorDenied<span style="color: #002200;">&#41;</span>
       NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;El usuario ha denegado el acceso a GPS&quot;</span><span style="color: #002200;">&#41;</span>;
  <span style="color: #a61390;">else</span>
       NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Se ha producido algún error interno&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Con estos métodos ya tenemos todo para leer las coordenadas. En el parámetro newLocation del primer método nuestro &#8220;Location Manager&#8221; enviará las coordenadas nuevas y nosotros las usuaríamos para hacer X en nuestro programa.</p>
<p>El segundo método se lamará cuando haya algún error. El error puede ser debido a que el usuario haya denegado el acceso al GPS o por otro motivo (<a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/doc/uid/TP40007125-CH3-DontLinkElementID_2">ver la documentación</a> para ver los posibles constantes de error existentes).</p>
<p>Hasta aquí lo más básico.</p>
<p>En una aplicación real con sólo esto no sería suficiente.</p>
<p>El primer problema está en la precisión de las coordenadas obtenidas. A la que se pide al locaton manager que empiece a obtener coordenadas (stratUpdatingLocation) este comienza a enviar las coordenadas que obtiene mediante triangulación de las antenas de telefonía móvil y mientras tanto intenta sincronizarse con los satélites para obtener coordenadas más precisas.</p>
<p>Esas primeras coordenadas que obtiene pueden ser muy imprecisas (pueden a llegar a tener un error de más de 10Km) y muchas veces es mejor que nuestro programa los ignore para no engañar al usuario. Para eso en el método donde leemos las nuevas coordenadas tenemos que filtrar los que no tienen la precisión suficiente para nuestro programa.</p>
<p>Para eso se usa la propiedad horizontalAccuracy (que se da en metros) del nuestro objeto de  tipo CLLocation.</p>
<p>Veamos un ejemplo:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>locationManager<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocationManager <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>manager didUpdateToLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>newLocation fromLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>oldLocation<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">//Si el error de la nueva coordenada es mayor o igual a 100 metros usar la coordenada</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>newLocation.horizontalAccuracy <span style="color: #002200;">&amp;</span>lt;<span style="color: #002200;">=</span> <span style="color: #2400d9;">100.0</span> <span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>
               ;<span style="color: #11740a; font-style: italic;">//Usar la nueva coordenada</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Con esto solucionamos el posible problema que pudieramos tener con la precisión.</p>
<p>Otro problema que puede haber tiene que ver con la cache de coordenadas que mantiene el sistema operativo.<br />
El location manager nos puede enviar, al principio, coordenadas que ha obtenido hace muchas horas. Entonces también tenemos que controlar eso si queremos tener siempre datos frescos. Para eso tenemos que medir el tiempo que ha pasado desde que se ha obtenido una coordenada. El método anterior con este arreglo se quedaría así:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>locationManager<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocationManager <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>manager didUpdateToLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>newLocation fromLocation<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CLLocation <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>oldLocation<span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">//Obtenemos la fecha de obtención de la coordenada</span>
	<span style="color: #400080;">NSDate</span><span style="color: #002200;">*</span> newLocationeventDate <span style="color: #002200;">=</span> newLocation.timestamp;
&nbsp;
        <span style="color: #11740a; font-style: italic;">//Obtenemos el tiempo (en segundos) que ha pasado desde que se obtenido nuestra coordenada</span>
	NSTimeInterval howRecentNewLocation <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>newLocationeventDate timeIntervalSinceNow<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">//Si el error es menor u igual a 100 metros y la coordenada se ha obtenido en los útlimos 20 segundos</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>newLocation.horizontalAccuracy <span style="color: #002200;">&amp;</span>lt;<span style="color: #002200;">=</span> <span style="color: #2400d9;">100.0</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; howRecentNewLocation <span style="color: #002200;">&amp;</span>lt; <span style="color: #002200;">-</span><span style="color: #2400d9;">0.0</span> <span style="color: #002200;">&amp;</span>amp;<span style="color: #002200;">&amp;</span>amp; howRecentNewLocation <span style="color: #002200;">&amp;</span>gt; <span style="color: #002200;">-</span><span style="color: #2400d9;">20.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>
		;<span style="color: #11740a; font-style: italic;">//Usar coordenada</span>
	<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Con esto solucionamos el problema de la cache. Pero hay un detalle más a tener en cuenta y es que puede que el GPS manager nunca llegue a obtener las coordenadas con la precisión que queremos nosotros y hacer que nos quedemos a esperar a esa coordenada para siempre.<br />
Para eso se ha de programa un timer. No voy a explicar detalles de como programarlo pero la idea consiste en que un timer llame a un método pasado N segundos (nuestro timeout definido para el gps). Ese método que se ejecutará N segundos después y comprobará si en esos N segundos se ha obtenido alguna coordenada si es que si entonces no hay problema, si es que no, entonces debería notificar al usuario o a algún subsistema del programa que deje de esperar al gps o que cambie la precisión requerida o cualquier otra cosa más que se nos ocurra.<br />
Aquí va un pseudocódigo:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">...
<span style="color: #002200;">&#91;</span><span style="color: #400080;">NSTimer</span> scheduledTimerWithTimeInterval<span style="color: #002200;">:</span> <span style="color: #2400d9;">13.0</span> target<span style="color: #002200;">:</span>self selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>gpsTimeOut<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> userInfo<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> repeats<span style="color: #002200;">:</span> <span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
...
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> gpsTimeOut<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSTimer</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> theTimer <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self seHaObtenidoCoordenada<span style="color: #002200;">&#93;</span> <span style="color: #002200;">!=</span> <span style="color: #a61390;">YES</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>
               <span style="color: #11740a; font-style: italic;">//Hacer lo que sea si en 13 segundos no se ha obtenido una coordenada</span>
       <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Con esto cerramos este minitutorial sobre el uso de GPS. Si tenéis preguntas no dudéis en formularlos en los comentarios.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/04/programar-el-gps-del-iphone-para-obtener-las-coordenadas-del-dispositivo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>¿Cómo encontrar el UUID (o UDID) del iPhone?</title>
		<link>http://www.zenbrains.com/blog/en/2010/04/%c2%bfcomo-encontrar-el-uuid-o-udid-del-iphone/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/04/%c2%bfcomo-encontrar-el-uuid-o-udid-del-iphone/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 15:05:54 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[udid]]></category>
		<category><![CDATA[uuid]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=182</guid>
		<description><![CDATA[En este artículo vamos a explicar como encontrar el identificador (no confundirlo con el número de serie) del iPhone (iPod y iPad)  también conocido como &#8220;device id&#8221;. Tenemos que seguir los siguientes pasos: Conectar nuestro dispositivo al ordenador (Mac o Windows). Abrir el iTunes. Seleccionar nuestro dispositivo en la lista de dispositivos. . Seleccionar la [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2F%25c2%25bfcomo-encontrar-el-uuid-o-udid-del-iphone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2F%25c2%25bfcomo-encontrar-el-uuid-o-udid-del-iphone%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>En este artículo vamos a explicar como encontrar el identificador (no confundirlo con el número de serie) del iPhone (iPod y iPad)  también conocido como &#8220;device id&#8221;.</p>
<p>Tenemos que seguir los siguientes pasos:</p>
<ol>
<li>Conectar nuestro dispositivo al ordenador (Mac o Windows).</li>
<li>Abrir el iTunes.</li>
<li>Seleccionar nuestro dispositivo en la lista de dispositivos.<br />
<a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-11.png"><img class="alignnone size-full wp-image-198" title="Imagen-1" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-11.png" alt="" width="192" height="130" /></a><br />
.</li>
<li>Seleccionar la pestaña Resumen y hacer click sobre el texto &#8220;Número de serie&#8221;. Al hacer esto el número de serie cambiará y mostrará el identificador.<br />
<a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-21.png"><img class="alignnone size-full wp-image-199" title="Imagen-2" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-21.png" alt="" width="559" height="276" /></a><br />
Después del click en &#8220;Número de serie&#8221; debería ver el identificador:</p>
<p><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-3.png"><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-31.png"><img class="alignnone size-full wp-image-200" title="Imagen-3" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Imagen-31.png" alt="" width="597" height="48" /></a><br />
</a></li>
</ol>
<p>Finalmente, si queremos copiar el identificador vamos al menú: Edición &gt; Copiar (mientras el identificador este visible).</p>
<p>Si estamos en un sitio donde no tenemos acceso a nuestro ordenador pero si tenemos acceso a Internet podemos conectarnos a AppStore y descar una de las aplicaciones especializadas que nos muestran nuestro device id y permiten enviarlo fácilmente. Dos de esas aplicaciones son: <a href="http://itunes.apple.com/us/app/info-udid/id348686512?mt=8">Info  – UDID</a> y <a href="http://itunes.apple.com/us/app/info-udid-sender/id366236549?mt=8">Info  – UDID Sender.</a></p>
<p>Si tiene preguntas no dude en contactar con nosotros.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/04/%c2%bfcomo-encontrar-el-uuid-o-udid-del-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find your iPhone or iPod (and iPad) device id (UDID or UUID)</title>
		<link>http://www.zenbrains.com/blog/en/2010/04/how-to-find-your-iphone-or-ipod-and-ipad-device-id-udid/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/04/how-to-find-your-iphone-or-ipod-and-ipad-device-id-udid/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 14:43:09 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[udid]]></category>
		<category><![CDATA[uuid]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=167</guid>
		<description><![CDATA[In order to find your device id you have to: Connect the device to your computer (Mac or Windows). Open the iTunes. Select your device. . Go to summary tab and click on &#8220;Serial Number&#8221;. You&#8217;ll notice that the &#8220;Serial Number&#8221; changes to &#8220;Identifier&#8221;. After clicking on the &#8220;Serial Number&#8221; we must see something like [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2Fhow-to-find-your-iphone-or-ipod-and-ipad-device-id-udid%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F04%2Fhow-to-find-your-iphone-or-ipod-and-ipad-device-id-udid%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In order to find your device id you have to:</p>
<ol>
<li>Connect the device to your computer (Mac or Windows).</li>
<li>Open the iTunes.</li>
<li>Select your device.<br />
<a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-1.png"><img class="alignnone size-full wp-image-170" title="Picture 1" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-1.png" alt="" width="194" height="137" /></a><br />
.</li>
<li>Go to summary tab and click on &#8220;Serial Number&#8221;. You&#8217;ll notice that the &#8220;Serial Number&#8221; changes to &#8220;Identifier&#8221;.<br />
<a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-2.png"><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-21.png"><img class="alignnone size-full wp-image-202" title="Picture-2" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-21.png" alt="" width="599" height="276" /></a><br />
</a></p>
<p>After clicking on the &#8220;Serial Number&#8221; we must see something like this:<br />
<a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-11.png"><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-111.png"><img class="alignnone size-full wp-image-203" title="Picture-11" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/04/Picture-111.png" alt="" width="589" height="45" /></a><br />
</a></li>
</ol>
<p>Finally if you want to copy the id: click on Edit &gt; Copy (while the Identifier is visible).</p>
<p>If you haven&#8217;t access to your computer but you have Internet connection you can download some free specialized apps (<a href="http://itunes.apple.com/us/app/info-udid/id348686512?mt=8">Info &#8211; UDID</a> or <a href="http://itunes.apple.com/us/app/info-udid-sender/id366236549?mt=8">Info &#8211; UDID Sender</a>) from AppStore which can provide you with your device id information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/04/how-to-find-your-iphone-or-ipod-and-ipad-device-id-udid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>¿Son efectivos los anuncios en Facebook?</title>
		<link>http://www.zenbrains.com/blog/en/2010/02/%c2%bfson-efectivos-los-anuncios-en-facebook/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/02/%c2%bfson-efectivos-los-anuncios-en-facebook/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 15:22:41 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Marketing]]></category>
		<category><![CDATA[anuncios]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[applicaciones]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[publicidad]]></category>
		<category><![CDATA[zentap]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=91</guid>
		<description><![CDATA[En nuestro caso si lo son. Cono ya sabreís de los posts anteriores (1 y 2) hemos empezado a anunciar ZenTap Pro en el Facebook. En este post les daré los datos de los resultados obtenidos. Llevamos aproximadamente dos semanas anunciándonos con presupuesto diario de sólo 2$. Hemos puesto como puja máxima por click 0,2$. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F02%2F%25c2%25bfson-efectivos-los-anuncios-en-facebook%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F02%2F%25c2%25bfson-efectivos-los-anuncios-en-facebook%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: center;"><a href="http://www.zenbrains.com/blog/wp-content/uploads/2010/02/n_1186439527_logo_facebook-rgb-7inc.jpg"><img class="aligncenter size-full wp-image-94" title="Facebook" src="http://www.zenbrains.com/blog/wp-content/uploads/2010/02/n_1186439527_logo_facebook-rgb-7inc.jpg" alt="" width="384" height="145" /></a></p>
<p>En nuestro caso si lo son. Cono ya sabreís de los posts anteriores (<a href="http://www.zenbrains.com/blog/2010/01/dia-d/">1</a> y <a href="http://www.zenbrains.com/blog/2010/01/despues-del-dia-d/">2</a>) hemos empezado a anunciar <a href="http://www.zenbrains.com/zentap">ZenTap Pro</a> en el Facebook.</p>
<p>En este post les daré los datos de los resultados obtenidos.</p>
<p>Llevamos aproximadamente dos semanas anunciándonos con presupuesto diario de sólo 2$. Hemos puesto como puja máxima por click 0,2$. Con esta configuración obtenemos de media 13 clicks al día sobre el anuncio y unos 13.000 impresiones.</p>
<p>También hacemos un seguimiento de la gente que viene vía anuncios. De esos 13 que nos llegan de media unos 3 hacen click sobre el botón &#8220;Ir a Itunes para comprar&#8221;.</p>
<p>Desde que llevamos esta mini camapaña hemos aumentado las ventas entre 1 y 2 unidades.</p>
<p>¿Vale la pena?</p>
<p>En nuestro caso si que vale. Zentap vale 2,99$ (2$ limpios para nosotros). Entonces con que una persona lo compre ya nos compensa el anuncio.</p>
<p>En el caso que no nos compensase en forma de ingresos tal vez valiera la pena perder un poco de dinero pero extender el uso de la app.</p>
<p>Otra cosa a tener en cuenta lo llamativa que es tu app. En nuestro caso en el anuncio ponemos &#8220;Type faster on your iPhone&#8221; y esto llama mucho la atención (y la app lo cumple).</p>
<p>Resumiendo, si tienes una aplicación entre las manos que cuesta más de 0,99$ y tiene algo llamativa vale la pena anunciarse en el facebook.</p>
<p>¿Que experiencias habéis tenido vosotros, os ha compensado anunciarse en el facebook?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/02/%c2%bfson-efectivos-los-anuncios-en-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como crear ficheros zip en el iPhone</title>
		<link>http://www.zenbrains.com/blog/en/2010/01/como-crear-ficheros-zip-en-el-iphone/</link>
		<comments>http://www.zenbrains.com/blog/en/2010/01/como-crear-ficheros-zip-en-el-iphone/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:45:19 +0000</pubDate>
		<dc:creator>Aram Julhakyan</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.zenbrains.com/blog/en/?p=73</guid>
		<description><![CDATA[Hoy voy a explicar como se puede comprimir ficheros (formato zip) desde el código. Es muy útil saberlo porque se usa muchisimo. A la que queramos que el usuario pueda descargar contenidos desde nuestro programa (por ejemplo la galería de fotos que haya creado) o subir grupos de ficheros a Internet vamos a necesitar poder [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F01%2Fcomo-crear-ficheros-zip-en-el-iphone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.zenbrains.com%2Fblog%2Fen%2F2010%2F01%2Fcomo-crear-ficheros-zip-en-el-iphone%2F&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hoy voy a explicar como se puede comprimir ficheros (formato zip) desde el código.<br />
Es muy útil saberlo porque se usa muchisimo. A la que queramos que el usuario pueda descargar contenidos desde nuestro programa (por ejemplo la galería de fotos que haya creado) o subir grupos de ficheros a Internet vamos a necesitar poder crear zips.<br />
Vamos a ello.<br />
Para crear los zip lo más cómodo (a día de hoy) es usar <a href="http://code.google.com/p/ziparchive/">ZipArchive</a>. Ziparchive es un wrapper para la librería minizip.</p>
<p>Si descargaís el ZipArchive este ya contiene los ficheros de la librería minizip.</p>
<p><strong>Instalación</strong></p>
<ol>
<li>Descargar el ZipArchive y descomprimirlo.</li>
<li>Crear un nuevo grupo llamado &#8220;minizip&#8221; en vuestro proyecto.</li>
<li>Añadir los ficheros de la carpeta minizip al grupo minizip de vuestro proyecto.</li>
<li>También añadir los fichero ZipArchive.h y ZipArchive.mm a vuestro proyecto.</li>
<li>Incluir la libreria libz en los frameworks de su proyecto (botón derecha &#8220;Add Existing Frameworks&#8221;. Libz suele estar en la siguiente carpeta: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOSNUMERO.sdk/usr/lib. Al escribir este post usaba el siguiente fichero: libz.1.2.3.dylib.</li>
</ol>
<p>Con esto ya tendremos todo preparado para usar ZipArchive desde nuestro código.</p>
<p><strong>Uso</strong></p>
<p>Ejemplo de compressión de ficheros:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;ZipArchive.h&quot;</span>
<span style="color: #6e371a;">#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@&quot;Documents&quot;]</span>
...
ZipArchive <span style="color: #002200;">*</span>zip <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>ZipArchive alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">//Creo el fichero zip en la carpeta Documents de mi app</span>
<span style="color: #a61390;">BOOL</span> ret <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>zip CreateZipFile2<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DOCUMENTS_FOLDER stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;zipEjemplo.zip&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Añado el fichero /Documents/prueba.txt al zip</span>
ret <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>zip addFileToZip<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DOCUMENTS_FOLDER stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;/prueba.txt&quot;</span><span style="color: #002200;">&#93;</span> newname<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;prueba.txt&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Añado el fichero /Documents/prueba2.txt dentro la carpeta PrimeraCarpeta en el zip</span>
ret <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>zip addFileToZip<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DOCUMENTS_FOLDER stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;/prueba2.txt&quot;</span><span style="color: #002200;">&#93;</span> newname<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;PrimeraCarpeta/prueba.txt&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Al poner en el new name @&quot;PrimeraCarpeta/prueba.txt&quot; automáticamente se creará la carpeta PrimeraCarpeta en el zip.</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//Finalmente cerramos el zip y liberamos la memoria</span>
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> <span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span>zip CloseZipFile2<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">//Si llegamos aquí es que ha habido un error</span>
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#91;</span>zip release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Ejemplo de como descomprimir un zip (este ejemplo está en la <a href="http://code.google.com/p/ziparchive/wiki/PageName">documentación oficial</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;ZipArchive.h&quot;</span>
<span style="color: #6e371a;">#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@&quot;Documents&quot;]</span>
...
       ZipArchive<span style="color: #002200;">*</span> za <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>ZipArchive alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
        <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span>za UnzipOpenFile<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DOCUMENTS_FOLDER stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;zipEjemplo.zip&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
                <span style="color: #a61390;">BOOL</span> ret <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>za UnzipFileTo<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>DOCUMENTS_FOLDER stringByAppendingString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;/miCarpeta&quot;</span><span style="color: #002200;">&#93;</span> overWrite<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
                <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> <span style="color: #a61390;">NO</span><span style="color: #002200;">==</span>ret <span style="color: #002200;">&#41;</span><span style="color: #002200;">&#123;</span>
                        <span style="color: #11740a; font-style: italic;">// Gestión de errores</span>
                <span style="color: #002200;">&#125;</span>
                <span style="color: #002200;">&#91;</span>za UnzipCloseFile<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#125;</span>
        <span style="color: #002200;">&#91;</span>za release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Con esto termino este mini artículo sobre zips en el iPhone.<br />
Para dudas/preguntas/correciones podéis usar los comentarios o el foro.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenbrains.com/blog/en/2010/01/como-crear-ficheros-zip-en-el-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

