<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>cocoa-touch &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/cocoa-touch/</link>
	<description>Feed of posts on WordPress.com tagged "cocoa-touch"</description>
	<pubDate>Thu, 26 Nov 2009 04:36:34 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Some Cocoa Touch Tips, Not Tricks]]></title>
<link>http://jeboyer.wordpress.com/2009/11/15/some-cocoa-touch-tips-not-tricks/</link>
<pubDate>Mon, 16 Nov 2009 00:55:33 +0000</pubDate>
<dc:creator>jeboyer</dc:creator>
<guid>http://jeboyer.wordpress.com/2009/11/15/some-cocoa-touch-tips-not-tricks/</guid>
<description><![CDATA[I&#8217;ve made significant progress on my prototype iPhone app since my last post. I&#8217;m contin]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="clear:both;">I&#8217;ve made significant progress on my prototype iPhone app since my last post. I&#8217;m continuing to learn something new during each coding session. This post contains my learning nuggets and a few code snippets that I hope you&#8217;ll find useful.</p>
<h4>Table View Development</h4>
<p style="clear:both;">I&#8217;m developing a productivity app, so it makes heavy use of <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKit_Framework/index.html" target="_self">UIKit&#8217;s</a> <a href="http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html">UITableView</a> classes. Here&#8217;s a few key things to remember as you develop your <a href="http://developer.apple.com/iphone/library/DOCUMENTATION/UIKit/Reference/UITableViewController_Class/Reference/Reference.html">UITableViewController</a>.</p>
<ol>
<li>Set a table cell&#8217;s text elements from your model in the<em>cellForRowAtIndexPath </em>method</li>
<li>Set a cell&#8217;s row height by implementing the <em>heightForRowAtIndexPath</em> method</li>
<li>Change the appearance of a cell&#8217;s label text (<em>textLabel</em> and <em>detailedTextLabel</em>) by setting the corresponding property.</li>
<p><!-- HTML generated using hilite.me --></p>
<div style="overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;">
<pre style="margin:0;">cell.textLabel.font <span style="color:#666666;">=</span> [UIFont <span style="color:#002070;font-weight:bold;">systemFontOfSize:</span>[UIFont labelFontSize]];
cell.textLabel.textColor <span style="color:#666666;">=</span> [UIColor grayColor];</pre>
</div>
<li style="margin-top:20px;">Respond to row selections in the <em>didSelectRowAtIndexPath </em>method. The code for inclusive and exclusive selection is in Apple&#8217;s iPhone Table View Programming guide <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/ManageSelections/ManageSelections.html#//apple_ref/doc/uid/TP40007451-CH9-SW7" target="_self">here</a>.</li>
</ol>
<h4>Manipulating Dates</h4>
<p>Displaying dates requires the use of the <a href="http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSDateFormatter_Class/Reference/Reference.html" target="_self">NSDateFormatter</a> class.</p>
<ol>
<li>Avoid learning the hard way, case matters in your date <a href="http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns" target="_self">format strings</a>, e.g., <em>yyyy-MM-dd</em>. Here&#8217;s a good <a href="http://cocoawithlove.com/2009/05/simple-methods-for-date-formatting-and.html" target="_self">post</a> that covers the problem.</li>
<li>Computing dates (or what Apple refers to as <a href="http://developer.apple.com/iphone/library/DOCUMENTATION/Cocoa/Conceptual/DatesAndTimes/Articles/dtCalendricalCalculations.html" target="_self">calendrical calculations</a>) is a bit too verbose from me. Here&#8217;s how to calculate the top of the hour.</li>
</ol>
<p><!-- HTML generated using hilite.me --></p>
<div style="overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;">
<pre style="margin:0;">NSDate <span style="color:#666666;">*</span>today <span style="color:#666666;">=</span> [NSDate date];
NSCalendar <span style="color:#666666;">*</span>gregorian <span style="color:#666666;">=</span> [[NSCalendar alloc] <span style="color:#002070;font-weight:bold;">initWithCalendarIdentifier:</span>NSGregorianCalendar];

NSDateComponents <span style="color:#666666;">*</span>minutesComponent <span style="color:#666666;">=</span> [gregorian <span style="color:#002070;font-weight:bold;">components:</span>NSMinuteCalendarUnit <span style="color:#002070;font-weight:bold;">fromDate:</span>today];
NSDateComponents <span style="color:#666666;">*</span>secondsComponent <span style="color:#666666;">=</span> [gregorian <span style="color:#002070;font-weight:bold;">components:</span>NSSecondCalendarUnit <span style="color:#002070;font-weight:bold;">fromDate:</span>today];

NSDateComponents <span style="color:#666666;">*</span>componentsToSubtract <span style="color:#666666;">=</span> [[NSDateComponents alloc] init];
[componentsToSubtract <span style="color:#002070;font-weight:bold;">setMinute:</span><span style="color:#40a070;">0</span> <span style="color:#666666;">-</span> [minutesComponent minute] ];
[componentsToSubtract <span style="color:#002070;font-weight:bold;">setSecond:</span><span style="color:#40a070;">0</span> <span style="color:#666666;">-</span> [secondsComponent second] ];

NSDate <span style="color:#666666;">*</span>topOftheHour <span style="color:#666666;">=</span> [gregorian <span style="color:#002070;font-weight:bold;">dateByAddingComponents:</span>componentsToSubtract <span style="color:#002070;font-weight:bold;">toDate:</span>today <span style="color:#002070;font-weight:bold;">options:</span><span style="color:#40a070;">0</span>];</pre>
</div>
<h4>Internet Access</h4>
<p>For applications accessing internet resources, here&#8217;s a few tidbits:</p>
<ul>
<li>To indicate network activity, it&#8217;s easy to add spinner or <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIActivityIndicatorView_Class/Reference/UIActivityIndicatorView.html#//apple_ref/doc/uid/TP40006830-CH3-DontLinkElementID_1">UIActivityIndicatorView</a> to a view. However, if the main thread is too busy, it will not appear.</li>
<li>The result of a URL connection (or <em>NSURLConnection</em>) is a binary <em>NSData</em> object, convert it to a string by invoking <em>initWithData</em> in <a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/uid/20000154-initWithData_encoding_" target="_self">NSString</a>.</li>
<li>Parsing <a href="http://www.json.org/" target="_self">JSON</a> objects is a breeze with the <a href="http://code.google.com/p/json-framework/" target="_self">JSON Framework for Objective-C</a>. By the way, for server-side Java, check out <a href="http://flexjson.sourceforge.net/" target="_self">Flexjson</a>, works like a charm.</li>
</ul>
<h4>Parsing Newlines</h4>
<p>Is parsing newlines as simple as searching for &#8220;\n&#8221;? No, take a gander at this code from Apple&#8217;s <a href="http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Strings/Articles/stringsParagraphBreaks.html#//apple_ref/doc/uid/TP40005016" target="_self">documentation</a>:<br />
<!-- HTML generated using hilite.me --></p>
<div style="overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;">
<pre style="margin:0;"><span style="color:#666666;">-</span> (NSMutableArray <span style="color:#666666;">*</span>) <span style="color:#002070;font-weight:bold;">parseRawString:</span> (NSString <span style="color:#666666;">*</span>) rawString  {
	<span style="color:#902000;">int</span> <span style="color:#902000;">unsigned</span> length <span style="color:#666666;">=</span> [rawString length];
	<span style="color:#902000;">int</span> <span style="color:#902000;">unsigned</span> paraStart <span style="color:#666666;">=</span> <span style="color:#40a070;">0</span>, paraEnd <span style="color:#666666;">=</span> <span style="color:#40a070;">0</span>, contentsEnd <span style="color:#666666;">=</span> <span style="color:#40a070;">0</span>;
	NSMutableArray <span style="color:#666666;">*</span>array <span style="color:#666666;">=</span> [NSMutableArray array];
	NSRange currentRange;
	<span style="color:#007020;font-weight:bold;">while</span> (paraEnd <span style="color:#666666;">&#60;</span> length) {
	      [rawString <span style="color:#002070;font-weight:bold;">getParagraphStart:</span><span style="color:#666666;">&#38;</span>paraStart <span style="color:#002070;font-weight:bold;">end:</span><span style="color:#666666;">&#38;</span>paraEnd <span style="color:#002070;font-weight:bold;">contentsEnd:</span><span style="color:#666666;">&#38;</span>contentsEnd <span style="color:#002070;font-weight:bold;">forRange:</span>NSMakeRange(paraEnd, <span style="color:#40a070;">0</span>)];
	      currentRange <span style="color:#666666;">=</span> NSMakeRange(paraStart, contentsEnd <span style="color:#666666;">-</span> paraStart);
	      [array <span style="color:#002070;font-weight:bold;">addObject:</span>[rawString <span style="color:#002070;font-weight:bold;">substringWithRange:</span>currentRange]];
	}
	<span style="color:#007020;font-weight:bold;">return</span> array;
}</pre>
</div>
<p>Lastly, Google search and <a href="http://stackoverflow.com/" target="_self">stackoverflow</a> are your friends. If you get stuck, Google it, you&#8217;ll most likely find the answer in <a href="http://stackoverflow.com/" target="_self">stackoverflow</a> or the <a href="http://www.iphonedevsdk.com/" target="_self">iPhone Dev SDK</a> forum. (<em>However, always read Apple&#8217;s iPhone programming guides first</em>).</p>
<p>Well,that&#8217;s all I have for now, happy programming!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Programando para iPhone (2)]]></title>
<link>http://patxiescudero.wordpress.com/2009/10/15/programando-para-iphone-2/</link>
<pubDate>Thu, 15 Oct 2009 14:11:20 +0000</pubDate>
<dc:creator>Patxi Escudero Vázquez</dc:creator>
<guid>http://patxiescudero.wordpress.com/2009/10/15/programando-para-iphone-2/</guid>
<description><![CDATA[Siguiendo con el curso de programación para Cocoa Touch (iPhone OS), vuelvo a dejar un archivo con l]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Siguiendo con el curso de programación para Cocoa Touch (iPhone OS), vuelvo a dejar un archivo con la práctica sugerida en la presentación 2 (Lecture 2) del curso que proporcionan en Stanford.</p>
<p>En esta ocasión, se amplía la funcionalidad de la práctica de la presentación 1 (Lecture 1) llamada &#8220;WhatATool&#8221;, y se crea un nuevo proyecto (&#8220;HelloPoly&#8221;) que correrá bajo el simulador utilizando la nueva clase generada.</p>
<p>Para los que tengan alguna duda, tienen los archivos del proyecto XCode para consulta, o pueden preguntar desde aquí mismo.</p>
<p>Como la anterior vez, cuelgo el archivo comprimido con la extensión .doc por restricciones de wordpress. Tendrás que renombrarlo quitándo la extensión &#8220;.doc&#8221; para descomprimir los archivos.</p>
<p><a href="http://patxiescudero.wordpress.com/files/2009/10/lecture2-zip.doc">Lecture2.zip</a><br />
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/es/"><img style="border-width:0;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/es/88x31.png" alt="Creative Commons License" /></a></p>
<p>Esta obra es publicada bajo una <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/es/">licencia Creative Commons</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Programando para iPhone (1)]]></title>
<link>http://patxiescudero.wordpress.com/2009/10/07/programando-para-iphone-1/</link>
<pubDate>Wed, 07 Oct 2009 22:29:58 +0000</pubDate>
<dc:creator>Patxi Escudero Vázquez</dc:creator>
<guid>http://patxiescudero.wordpress.com/2009/10/07/programando-para-iphone-1/</guid>
<description><![CDATA[Como cabe suponer por el título escogido, me quiero embarcar en la programación de los dispositivos ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">Como cabe suponer por el título escogido, me quiero embarcar en la programación de los dispositivos móviles gobernados por el S.O (sistema operativo) iPhone OS. Quizá sería más correcto decir que el proceso de aprendizaje debe ser para programar bajo Cocoa / Cocoa Touch, que son las librerías o framework en las que se basa. Con Cocoa se realizarían los desarrollos nativos para Mac OS X, y con Cocoa Touch, que es una versión &#8220;aligerada&#8221; para dispositivos móviles de la casa y con capacidades táctiles, para iPhone OS.</p>
<p style="text-align:justify;">Puede ser una buena oportunidad (laboral o hobby), hay un apetitoso mercado objetivo, y bueno, tengo una posible aplicación en mente.</p>
<p style="text-align:justify;">Buscando por la gran enciclopedia que es La Red, la verdad es que no se encuentra gran cosa (de acceso libre), algunos manuales, algunos ejemplos muy particulares&#8230;pero poco más en castellano. La gran &#8220;fuente del conocimiento&#8221; está en la propia Apple, con su <a href="http://developer.apple.com/" target="_blank">Apple Developer Connection</a> en la que puedes encontrar toda la información que te puedas imaginar. Desde manuales, hasta ejemplos, pasando por vídeos&#8230;la verdad que muy completo. El otro gran sitio para encontrar libros es el archiconocido <a href="http://www.amazon.com/" target="_blank">Amazon</a>, la megatienda donde se puede comprar infinidad de productos de muy diverso tipo. Luego están las empresas que imparten cursos presenciales como los famosos cursos de los chicos de Invasivecode, pero a un precio de 2.850€ la semana&#8230;y con la crisis (o sin ella) está fuera de muchísmos presupuestos.</p>
<p style="text-align:justify;">¿Por qué opción he optado yo?. Lógicamente por las gratuitas, y para ello, un muy buen sitio para estudiar es la Universidad de Stanford. Que no, que no, que es gratuito, en serio!</p>
<p style="text-align:justify;">Parece ser que Apple tiene un acuerdo de colaboración con esta famosísima Universidad americana (muchos ingenieros de software de sus filas han salido de allí) e imparten cursos específicos para Cocoa Touch / iPhone OS.</p>
<p style="text-align:justify;">El curso lo podéis seguir desde iTunesU, en el que os podéis descargar los vídeos de las clases, y desde <a href="http://www.stanford.edu/class/cs193p/cgi-bin/index.php" target="_blank">esta</a> página de Stanford, podéis encontrar el material de las clases (PDFs con las presentaciones, ejemplos de proyectos XCode) y los ejercicios que han propuesto a los estudiantes.</p>
<p style="text-align:justify;">Yo dejo en una archivo zip mis proyectos XCode de los ejercicios propuestos en la primera conferencia (Lecture 1), por si alguien los necesita para consulta. El fichero está renombrado a &#8220;Stanford.zip.doc&#8221; para poder subirlo a wordpress, y deberás dejarlo en &#8220;Stanford.zip&#8221; para poder descomprimirlo.</p>
<p style="text-align:justify;">Espero que os sirva&#8230;</p>
<p style="text-align:justify;"><a href="http://patxiescudero.wordpress.com/files/2009/10/stanford-zip.doc">Stanford.zip</a></p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/es/"><img style="border-width:0;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/es/88x31.png" alt="Creative Commons License" /></a><br />
Esta obra está bajo una <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/es/">licencia de Creative Commons</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[iPhone OS - &Sigma;ύ&nu;&omicron;&psi;&eta;]]></title>
<link>http://gbikas.wordpress.com/2009/08/15/iphone-os-%cf%83%cf%8d%ce%bd%ce%bf%cf%88%ce%b7/</link>
<pubDate>Sat, 15 Aug 2009 16:11:52 +0000</pubDate>
<dc:creator>Μπίκας Γιώργος</dc:creator>
<guid>http://gbikas.wordpress.com/2009/08/15/iphone-os-%cf%83%cf%8d%ce%bd%ce%bf%cf%88%ce%b7/</guid>
<description><![CDATA[Ένα λειτουργικό το οποίο ήρθε για να μείνει και να προσφέρει! Σίγουρα μια από τις μεγαλύτερες πρωτοτ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img style="display:inline;margin-left:0;margin-right:0;" align="right" src="http://thevoyager.gr/wp-content/uploads/2009/02/iphone_3g_2.jpg" width="240" height="180" /> Ένα λειτουργικό το οποίο ήρθε για να μείνει και να προσφέρει! Σίγουρα μια από τις μεγαλύτερες πρωτοτυπίες που έχουμε δει, χωρίς προηγούμενο και σίγουρα δεν υπερβάλω. Η Apple απέδειξε ότι έχει τεράστια υπέροχη συγκριτικά με άλλες εταιρίες παράγωγης mp3 player και κατάφερε να μετατρέψει τις πωλήσεις του iPod σε μονοπώλιο Έτσι αποφάσισε να πάρει ένα ρίσκο (Το είχε πάρει και παλαιοτέρα, <a title="Newton" href="http://upload.wikimedia.org/wikipedia/commons/7/76/Apple_Newton_and_iPhone.jpg" target="_blank"><strong>Newton 1989</strong></a>), και να μπει στην βιομηχανία των κινητών τηλεφώνων.</p>
<p>Φυσικά όλοι πίστευαν ότι θα είχε κάποια επιτυχία άλλα ακόμα και ο πιο αισιόδοξος έπεσε έξω. Το αποτέλεσμα ήταν η Apple να βρεθεί πολλές φορές εκτεθειμένη καθώς πολλά σημεία πώλησης ξεπούλησαν τις συσκευές</p>
<p><strong>Τι είναι λοιπόν το iPhone OS?</strong></p>
<p>Είναι λειτουργικό σύστημα που βασίζετε στη έκδοση του OS X. Η δομή του είναι παρόμοια, σαφώς λίγο τροποποιημένη για να χωρέσει σε 600Mb. Η τροποποίηση αυτή δημιούργησε ένα ακόμα πλαίσιο προγραμματισμού με την ονομασία Cocoa touch.</p>
<p><strong>Εφαρμογές για το iPhone OS?</strong></p>
<p>Το ποιο δυνατό κομμάτι του iPhone είναι οι εφαρμογές που προσφέρει καθώς το νούμερο είναι κάθε άλλο παρά φυσικό ξεπερνώντας τις 60.000. Η Apple γνώριζε ότι δεν μπορεί να αντεπεξέλθει δημιουργώντας εφαρμογές έτσι έδωσε το SDK (Software development kit) στους προγραμματιστές ώστε να κάνουν την δουλειά αυτοί και να υπάρχει και άμεσο κέρδος αν υπολογίσετε ότι από κάθε εγγραφή έχει 100$/τον χρόνο και από κάθε πώληση ένα μικρό ποσοστό! Πανέξυπνο&#8230;</p>
<p><strong>Που μειονεκτεί το iPhone OS?</strong></p>
<p>Προγραμματικά δεν ξέρω και δεν βρίσκω κάτι. Ίσως ένα bug που έκανε ευάλωτο το σύστημα σε επίθεση από hackers το οποίο σύμφωνα με την Apple έχει ήδη διορθωθεί.</p>
<p><strong>Τι κυκλοφορεί αυτήν την στιγμή?</strong></p>
<p>Η τελευταία (Major) έκδοση είναι η 3.0 τον Ιούλιο του 2009 και ήταν δωρεάν για τα iPhone και 9.95$ για τα iPod Touch.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[setEditing:animated: and swipe-to-delete issues]]></title>
<link>http://chaoticcocoa.wordpress.com/2009/07/27/seteditinganimated-and-swipe-to-delete-issues/</link>
<pubDate>Mon, 27 Jul 2009 15:47:26 +0000</pubDate>
<dc:creator>aviadbd</dc:creator>
<guid>http://chaoticcocoa.wordpress.com/2009/07/27/seteditinganimated-and-swipe-to-delete-issues/</guid>
<description><![CDATA[If you&#8217;re using a UITableView you probably know that in order to enable the &#8220;swipe-to-de]]></description>
<content:encoded><![CDATA[If you&#8217;re using a UITableView you probably know that in order to enable the &#8220;swipe-to-de]]></content:encoded>
</item>
<item>
<title><![CDATA[So langsam raff ichs...]]></title>
<link>http://nkreipke.wordpress.com/2009/07/13/so-langsam-raff-ichs/</link>
<pubDate>Mon, 13 Jul 2009 21:37:15 +0000</pubDate>
<dc:creator>nkreipke</dc:creator>
<guid>http://nkreipke.wordpress.com/2009/07/13/so-langsam-raff-ichs/</guid>
<description><![CDATA[Erst mal ein Vorwort: Natürlich hab ich mir kein iPhone gekauft, erst recht nicht hab ich eines geja]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a rel="attachment wp-att-130" href="http://nkreipke.wordpress.com/2009/07/13/so-langsam-raff-ichs/xcode/"><img class="alignleft size-thumbnail wp-image-130" title="XCode" src="http://nkreipke.wordpress.com/files/2009/07/xcode.png?w=150" alt="XCode" width="150" height="110" /></a>Erst mal ein Vorwort: Natürlich hab ich mir kein iPhone gekauft, erst recht nicht hab ich eines gejailbreaked, ich finde das nämlich bekloppt. Das, wovon der Screenshot kam, war der iPhone-Simulator aus der iPhone SDK.</p>
<p>Und darum geht es in diesem Post auch, dem Erlernen einer neuen Programmiersprache und dem Verstehen von XCode, den Zusatzprogrammen und den unzähligen tollen Prameworks (mein liebstes ist das UIKit, weil es diese schönen Animationsfunktionen hat <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>Wenn man mit XCode programmieren will, obwohl man eigentlich in einer anderen Programmiersprache programmiert oder von Objective-C einfach nicht die Bohne Ahnung hat, ist es ultraschwer, sich einzuarbeiten.</p>
<p>Nach unzähligen Sample-Codes von der ADC (Apple Developer Connection) Seite hat man schon die Schnauze voll, weil man einfach nichts davon versteht, nicht mal in der einfachsten Kombination.</p>
<p>Allerdings hab ich eine wirklich sehr gute Seite im Internet gefunden, mit der ich es doch tatsächlich geschafft habe, <a href="http://program-art.com/whsprogger/helloworld.swf" target="_blank">mein erstes Hello World zu schreiben</a>:</p>
<p><a href="http://www.AppsAmuck.com/index.html">http://www.AppsAmuck.com/index.html</a></p>
<p>Für angehende iPhone-Programmierer die keinen Schimmer von der verwendeten Programmiersprache Obj-C haben nur zu empfehlen.</p>
<p>Und noch ein Tipp: Hat man einmal das erste Programm verstanden, versteht man auf einmal den ganzen Quelltext von den Beispiel Sources, bei denen man sich vorher den Kopf zerbrochen hat. Ehrlich!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Objective-C &amp; ActionScript 3 translation notes]]></title>
<link>http://jwopitz.wordpress.com/2009/06/05/objective-c-actionscript-3-translation-notes/</link>
<pubDate>Fri, 05 Jun 2009 05:56:20 +0000</pubDate>
<dc:creator>jwopitz</dc:creator>
<guid>http://jwopitz.wordpress.com/2009/06/05/objective-c-actionscript-3-translation-notes/</guid>
<description><![CDATA[[note to self] Just some things I am learning along the way while teaching myself Objective-C and iP]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>[note to self]</p>
<p>Just some things I am learning along the way while teaching myself Objective-C and iPhone development.   Seeing existing code is rather easy to understand in a general sense but the syntax is a tad whacky looking at this point.  I will continue to add to this as I find more translations.</p>
<h3>variables:</h3>
<pre style="padding-left:30px;">NSString * someString = @"foo";</pre>
<pre style="padding-left:30px;">=</pre>
<pre style="padding-left:30px;">var someString:String = "foo";</pre>
<h3>casting:</h3>
<pre style="padding-left:30px;">NSObject *someObject = //pretend I know how to say new();
NSString *castedAsString = (NSString *)someObject;</pre>
<pre style="padding-left:30px;">=</pre>
<pre style="padding-left:30px;">var someObject:Object = {};
var castedAsString:String = String(someObject);</pre>
<h3>strings:</h3>
<p>Strings come in several varieties in Objective-C.  There are <em>NSString</em>, <em>NSMutableString</em> and then the C varient <em>char</em>.  There are probably others I have yet to discover (CSString?).  Since most of what I have seen utilizes NSString, I will stick to that unless otherwise noted.</p>
<h4>combining string values</h4>
<pre style="padding-left:30px;">NSString *firstString = @"foo";
NSString *secondString = @"bar";
firstString = [firstString stringByAppendingString:secondString]; //should trace out as "foobar"</pre>
<pre style="padding-left:30px;">=</pre>
<pre style="padding-left:30px;">var firstString:String = "foo";
var secondString:String = "bar";
firstString = firstString + secondString; //wow AS3 is very simple when working with strings</pre>
<h3>class &#38; instance methods:</h3>
<pre style="padding-left:30px;">+someMethodDefinition = static public function</pre>
<pre style="padding-left:30px;">-someMethodDefinition = public function (instance function)</pre>
<h3>method calling:</h3>
<pre style="padding-left:30px;">NSString * someString = @"foo";
NSArray * someArray = [someString someNSStringMethodThatReturnsAnArray];</pre>
<pre style="padding-left:30px;">=</pre>
<pre style="padding-left:30px;">var someString:String = "foo";
var someArray:Array = someString.someStringFunctionThatReturnsAnArray();
//kinda made this up since I don't understand method arguments in Objective-C yet.</pre>
<h3>more to come&#8230;</h3>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MPMoviePlayerController Streaming Breaks Under Authentication]]></title>
<link>http://riactant.wordpress.com/2009/05/25/mpmovieplayercontroller-streaming-breaks-under-authentication/</link>
<pubDate>Tue, 26 May 2009 03:57:38 +0000</pubDate>
<dc:creator>riactant</dc:creator>
<guid>http://riactant.wordpress.com/2009/05/25/mpmovieplayercontroller-streaming-breaks-under-authentication/</guid>
<description><![CDATA[So my colleague and I have been stuck on an issue for about three weeks which we finally gave up on.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>So my colleague and I have been stuck on an issue for about three weeks which we finally gave up on. The application we&#8217;ve been developing requires streaming of an MP4 file from a Microsoft Office SharePoint Server (MOSS) 2007 server. The video file can only be accessed by authenticated users. Several other parts of our app authenticate just fine to the MOSS instance using NTLM authentication using NSURLConnection and NSURLDownload in our Objective-C code. However, once we try to access a video file, even if we&#8217;re already authenticated to the server and there is a valid identity in the iPhone Credential Cache, the app fails at the QuickTime player screen with an error to the effect of &#8220;the movie could not be played.&#8221;</p>
<p>For comparison and to rule out our own code, we tried to access the video URL directly from iPhone Safari &#8212; Safari will prompt for the user credentials when challenged by the MOSS instance, however entering the correct credentials and proceeding leads to the same error.</p>
<p>Upon consulting with relatively more experienced iPhone SDK folks here in the Seattle area and a few, very sparse, comments online, it appears Apple&#8217;s MPMoviePlayerController doesn&#8217;t work when a credential challenge is received. The consensus, although conjecture, seems to be that the MPMoviePlayerController is based on a Core Foundation (CF) Network class which is pretty low lever networking without much intelligence for handling authentication challenges. One of the gurus we chatted with recommended we write our own class, but unfortunately we don&#8217;t have the time to dig into the packet level and write our own class so we came up with a server-side workaround that provided sufficient security.</p>
<p>So beware authenticating to play a video/stream with MPMoviePlayerController &#8212; if you discover an answer or solution that we&#8217;ve missed, however, please let me know.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How your application’s user interface looks while a phone call is in progress]]></title>
<link>http://praveenmatanam.wordpress.com/2009/05/19/how-your-application%e2%80%99s-user-interface-looks-while-a-phone-call-is-in-progress/</link>
<pubDate>Tue, 19 May 2009 12:27:16 +0000</pubDate>
<dc:creator>praveenmatanam</dc:creator>
<guid>http://praveenmatanam.wordpress.com/2009/05/19/how-your-application%e2%80%99s-user-interface-looks-while-a-phone-call-is-in-progress/</guid>
<description><![CDATA[Toggle In-Call Status Bar. Toggles the status bar between its normal state and its in-call state. Th]]></description>
<content:encoded><![CDATA[Toggle In-Call Status Bar. Toggles the status bar between its normal state and its in-call state. Th]]></content:encoded>
</item>
<item>
<title><![CDATA[Lecture 2 - Objective-C]]></title>
<link>http://michelmongkhoy.wordpress.com/2009/05/03/lecture-2-objective-c/</link>
<pubDate>Sun, 03 May 2009 16:45:49 +0000</pubDate>
<dc:creator>Michel</dc:creator>
<guid>http://michelmongkhoy.wordpress.com/2009/05/03/lecture-2-objective-c/</guid>
<description><![CDATA[  J&#8217;avais déjà fait un post rapide sur Objective-C. Là vous aurez droit à un grand cours ^^ Le]]></description>
<content:encoded><![CDATA[  J&#8217;avais déjà fait un post rapide sur Objective-C. Là vous aurez droit à un grand cours ^^ Le]]></content:encoded>
</item>
<item>
<title><![CDATA[Assignement 1A - Hello Stanford!]]></title>
<link>http://michelmongkhoy.wordpress.com/2009/05/03/assignement-1a-hello-stanford/</link>
<pubDate>Sun, 03 May 2009 14:44:18 +0000</pubDate>
<dc:creator>Michel</dc:creator>
<guid>http://michelmongkhoy.wordpress.com/2009/05/03/assignement-1a-hello-stanford/</guid>
<description><![CDATA[  Pas grand chose à dire sur ce premier TP. Il suffit de suivre le PDF.  Sinon je viens de découvrir]]></description>
<content:encoded><![CDATA[  Pas grand chose à dire sur ce premier TP. Il suffit de suivre le PDF.  Sinon je viens de découvrir]]></content:encoded>
</item>
<item>
<title><![CDATA[Lecture 1 - Introduction to Mac OS X and Cocoa Touch]]></title>
<link>http://michelmongkhoy.wordpress.com/2009/05/03/lecture-1-introduction-to-mac-os-x-and-cocoa-touch/</link>
<pubDate>Sun, 03 May 2009 13:42:35 +0000</pubDate>
<dc:creator>Michel</dc:creator>
<guid>http://michelmongkhoy.wordpress.com/2009/05/03/lecture-1-introduction-to-mac-os-x-and-cocoa-touch/</guid>
<description><![CDATA[Cette première leçon est une introduction au développement iPhone (et au framework Cocoa Touch), et ]]></description>
<content:encoded><![CDATA[Cette première leçon est une introduction au développement iPhone (et au framework Cocoa Touch), et ]]></content:encoded>
</item>
<item>
<title><![CDATA[Calendar Control for iPhone Developers]]></title>
<link>http://nadim1point618.wordpress.com/2009/04/24/calendar-control-for-iphone-developers/</link>
<pubDate>Fri, 24 Apr 2009 07:12:30 +0000</pubDate>
<dc:creator>nadim1point618</dc:creator>
<guid>http://nadim1point618.wordpress.com/2009/04/24/calendar-control-for-iphone-developers/</guid>
<description><![CDATA[Some days ago when I was developing an iPhone application I required to use a calendar view, but unf]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Some days ago when I was developing an iPhone application I required to use a calendar view, but unfortunately I didn&#8217;t get any built-in control for it in Cocoa Touch UIKit. So I built it from the scratch. This is a single class and you can buy this from <a href="http://nrg.com.bd/nrg/NRGUICalendarView/paypal.php">here</a>. The following is the screenshot of this control.</p>
<p> </p>
<div id="attachment_4" class="wp-caption aligncenter" style="width: 396px"><img class="size-full wp-image-4" title="Screenshot of Calendar Control" src="http://nadim1point618.wordpress.com/files/2009/04/cal.jpg" alt="Screenshot of Calendar Control" width="386" height="742" /><p class="wp-caption-text">Screenshot of Calendar Control</p></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Develop applications for the iPhone]]></title>
<link>http://softhouseopenseminars.wordpress.com/2009/04/23/develop-applications-for-the-iphone/</link>
<pubDate>Thu, 23 Apr 2009 13:12:47 +0000</pubDate>
<dc:creator>Fredrik Hansson</dc:creator>
<guid>http://softhouseopenseminars.wordpress.com/2009/04/23/develop-applications-for-the-iphone/</guid>
<description><![CDATA[På nästa träff för Softhouse Open Seminars så kommer jag (Fredrik Hansson) att tala om hur man utvec]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="size-full wp-image-83 alignright" title="iphone development" src="http://softhouseopenseminars.wordpress.com/files/2009/04/index_cocoa.png" alt="iphone development" width="219" height="131" />På nästa träff för Softhouse Open Seminars så kommer jag (Fredrik Hansson) att tala om hur man utvecklar för Apples iPhone. Det blir en introduktion av iPhone OS, Cocoa Touch, Objective C och verktygen XCode samt Interface Builder. Vi håller det på en nivå för dig som inte varit i kontakt med iPhone tidigare.</p>
<p>Vi startar 1430 den 24/4 i Softhouse lokaler på Ölandsgatan 42. Välkomna!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Calendar Control for iPhone]]></title>
<link>http://nadimissimple.wordpress.com/2009/04/17/calendar-control-for-iphone/</link>
<pubDate>Fri, 17 Apr 2009 16:09:24 +0000</pubDate>
<dc:creator>Nadim Jahangir</dc:creator>
<guid>http://nadimissimple.wordpress.com/2009/04/17/calendar-control-for-iphone/</guid>
<description><![CDATA[Somedays ago when I was developing an iPhone application, I required to use a calendar control to sh]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Somedays ago when I was developing an iPhone application, I required to use a calendar control to show date specific information on it. First I thought that I might get a built-in control in Cocoa Touch UIKit, but unfortunately there is no such thing in that. So I create my own calendar control which is fully customizable. Here is the screenshot of my calendar control.</p>
<p> </p>
<p> </p>
<div id="attachment_285" class="wp-caption aligncenter" style="width: 396px"><img class="size-full wp-image-285" title="Calendar Control Demo" src="http://nadimissimple.wordpress.com/files/2009/04/cal.jpg" alt="Calendar Control Demo" width="386" height="742" /><p class="wp-caption-text">Calendar Control Demo</p></div>
<p>You can set the color theme, cell background image, day tag image, weekends and their colors. You can also change the first day of week. Actions can be set for event Touch Up Inside each day cell. Months and years can be navigated individually. Current day can be selected by passing goToday message to the calendar conrol object. This control is to be added as a subview of any view and I made it by inheriting UIView class. There is only a single class to do all this.</p>
<p>If anyone of you need this then go to <a href="http://nrg.com.bd/blog/archives/36">http://nrg.com.bd/blog/archives/36</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to disable UIWebView from user scrolling?]]></title>
<link>http://praveenmatanam.wordpress.com/2009/04/03/how-to-disable-uiwebview-from-user-scrolling/</link>
<pubDate>Fri, 03 Apr 2009 13:28:16 +0000</pubDate>
<dc:creator>praveenmatanam</dc:creator>
<guid>http://praveenmatanam.wordpress.com/2009/04/03/how-to-disable-uiwebview-from-user-scrolling/</guid>
<description><![CDATA[#import &lt;objc/runtime.h&gt; &nbsp;&nbsp;&nbsp; id scroller = [[Webview subviews] lastObject]; ]]></description>
<content:encoded><![CDATA[#import &lt;objc/runtime.h&gt; &nbsp;&nbsp;&nbsp; id scroller = [[Webview subviews] lastObject]; ]]></content:encoded>
</item>
<item>
<title><![CDATA[Creating a Splash Screen]]></title>
<link>http://radiancedeveloper.wordpress.com/2009/03/19/creating-a-splash-screen/</link>
<pubDate>Thu, 19 Mar 2009 14:28:53 +0000</pubDate>
<dc:creator>Steve Gongage</dc:creator>
<guid>http://radiancedeveloper.wordpress.com/2009/03/19/creating-a-splash-screen/</guid>
<description><![CDATA[Some great instructions on how to setup a Splash Screen for your application. iCodeBlog » Blog Archi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Some great instructions on how to setup a Splash Screen for your application.</p>
<p><a href="http://icodeblog.com/2009/03/18/iphone-game-programming-tutorial-part-3-splash-screen/">iCodeBlog » Blog Archive » iPhone Game Programming Tutorial Part 3 &#8211; Splash Screen</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to get country name from iPhone locale settings]]></title>
<link>http://praveenmatanam.wordpress.com/2009/03/19/how-to-get-country-name-from-iphone-locale-settings/</link>
<pubDate>Thu, 19 Mar 2009 05:23:28 +0000</pubDate>
<dc:creator>praveenmatanam</dc:creator>
<guid>http://praveenmatanam.wordpress.com/2009/03/19/how-to-get-country-name-from-iphone-locale-settings/</guid>
<description><![CDATA[&nbsp;&nbsp;&nbsp; NSLocale *locale = [NSLocale currentLocale]; &nbsp;&nbsp;&nbsp; NSString *country]]></description>
<content:encoded><![CDATA[&nbsp;&nbsp;&nbsp; NSLocale *locale = [NSLocale currentLocale]; &nbsp;&nbsp;&nbsp; NSString *country]]></content:encoded>
</item>
<item>
<title><![CDATA[PhoneGap - Access all iPhone Functionality with just HTML and JavaScript ]]></title>
<link>http://radiancedeveloper.wordpress.com/2009/03/17/phonegap-access-all-iphone-functionality-with-just-html-and-javascript/</link>
<pubDate>Tue, 17 Mar 2009 12:13:45 +0000</pubDate>
<dc:creator>Steve Gongage</dc:creator>
<guid>http://radiancedeveloper.wordpress.com/2009/03/17/phonegap-access-all-iphone-functionality-with-just-html-and-javascript/</guid>
<description><![CDATA[Now this is something I need to check out when I get a minute.  The basic premise of PhoneGap is tha]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Now this is something I need to check out when I get a minute.  The basic premise of <a href="http://phonegap.com/">PhoneGap</a> is that you use  HTML and JavaScript to write applications for the iPhone.  It exposes core features of the iPhone such as geolocation, the accelerometer, sound and vibration (I can&#8217;t even write that word without wanting to make a stupid joke&#8230; damn I&#8217;m a 10 year old&#8230;)</p>
<p>For more info:  <a href="http://phonegap.com/">PhoneGap &#124; Cross platform mobile framework</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[iPhone Email Attachments - Revisited]]></title>
<link>http://davidjhinson.wordpress.com/2009/03/11/iphone-email-attachments-revisited/</link>
<pubDate>Wed, 11 Mar 2009 19:10:41 +0000</pubDate>
<dc:creator>davidjhinson</dc:creator>
<guid>http://davidjhinson.wordpress.com/2009/03/11/iphone-email-attachments-revisited/</guid>
<description><![CDATA[My solution for sending messages via email on the iPhone &#8211; detailed here &#8211; works for eve]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My solution for sending messages via email on the iPhone &#8211; <a title="Embedding images in Cocoa Touch Email" href="http://davidjhinson.wordpress.com/2009/01/21/embedding-images-in-outbound-email-using-cocoa-touch/" target="_blank">detailed here</a> &#8211; works for every mail client&#8230; except Gmail.</p>
<p>Gmail simply will not let you see embedded images.  Period.</p>
<p>Since this kinda crap really grates on my nerves, I started digging a little deeper.  Plus, I really think there should be a 100% universal way to attach stuff to email messages from the iPhone&#8230; and I&#8217;m not the only one.  My embedded images solution is workable, but is not wholly satisfying &#8211; because it is not a 100% solution.</p>
<p>So, like I usually do when trying to sniff out how a particular piece of web software works without having access to the source, I see what is being sent &#8220;over the wire.&#8221;  And since I knew that iPhoto on the iPhone WAS able to send an attachment, I sent myself a picture&#8230; and then checked the raw message source to see how Apple was doing it.</p>
<p>I sent myself a picture, with no accompanying text, and this is what the &#8220;interesting&#8221; pieces looked like:</p>
<blockquote><p>Content-Type: multipart/mixed;<br />
boundary=Apple-Mail-1-782786827<br />
X-Mailer: iPhone Mail (5H11)<br />
Mime-Version: 1.0 (iPhone Mail 5H11)<br />
Date: Wed, 11 Mar 2009 12:13:43 -0400</p>
<p>&#8211;Apple-Mail-1-782786827<br />
Content-Type: text/plain;<br />
charset=us-ascii;<br />
format=flowed<br />
Content-Transfer-Encoding: 7bit</p>
<p>&#8211;Apple-Mail-1-782786827<br />
Content-Disposition: inline;<br />
filename=photo.jpg<br />
Content-Type: image/jpeg;<br />
name=&#8221;photo.jpg&#8221;<br />
Content-Transfer-Encoding: base64</p></blockquote>
<p>Notice the Content-Type of &#8220;multipart/mixed.&#8221;  No real surprise there&#8230; just that when you send a message using the Email client launched by an iPhone application, this is almost always &#8220;multipart/alternative&#8221;.  First &#8220;hmmm.&#8221;</p>
<p>Secondly, when I used my methodology of using embeded images (&#60;img src=&#8221;data:image/png;base64[my data here in base64]&#8220;&#62;), this gets cobbled out as</p>
<blockquote><p>Content-Type: text/html;<br />
charset=utf-8<br />
Content-Transfer-Encoding: quoted-printable</p></blockquote>
<p>by the Apple Email Client.  By contrast, Apple creates it&#8217;s image attachments by doing the following:</p>
<blockquote><p>Content-Disposition: inline;<br />
filename=photo.jpg<br />
Content-Type: image/jpeg;<br />
name=&#8221;photo.jpg&#8221;<br />
Content-Transfer-Encoding: base64</p></blockquote>
<p>So &#8211; why not just do the same thing?</p>
<p>Boundaries.</p>
<p>I don&#8217;t know what MIME boundaries (the &#8220;Apple-Mail-1-782786827&#8243; above) Apple is using to segregate its constituent email pieces (text, html, images, attachments) ahead of time &#8211; and they are generated dynamically by the email client when putting together it&#8217;s messages.</p>
<p>Bummer.</p>
<p>If I knew what the boundary tag was, I could fake out the client, create my own inline image, and boogey on down.</p>
<p>Now, even though this does seem like a serious roadblock, it may not be a total loss, because it presents both</p>
<ul>
<li>(a) a possible direction to look (fake out a boundary, unlikely though it may be) and</li>
<li>(b) it presents another solution path (go down to the socket level and code my own SMTP alternative, so that I can create the MIME code directly to send out my attachments).</li>
</ul>
<p>(a) looks to be a total non-starter, as it looks like the boundary is made &#8211; in part &#8211; of a timer component, and there is no way to guess how long someone will keep the message open before sending to reliably fake this out each and every time.  (b) will absolutely work &#8211; provided you are motivated to write this dude.  Looks like a commercial opportunity for a Cocoa Touch class, and I may yet do this.</p>
<p>A final and as yet unspoken work around would be to know how Apple preps an image in their email client before sending, so that it&#8217;s Mail.app knows to wrap the image up as an inline attachment.  Unfortunately, I don&#8217;t know of anywhere I can look to see how they compose their messages (no view source &#8211; dang!).</p>
<p>All in all, this has stimulated me to investigate some additional paths for a problem that I thought I had a reasonable solution for &#8211; and for many, I do and did.</p>
<p>Onward and upward.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Objective-C and HTTP Basic Authentication]]></title>
<link>http://davidjhinson.wordpress.com/2009/03/09/objective-c-and-http-basic-authentication/</link>
<pubDate>Mon, 09 Mar 2009 11:12:17 +0000</pubDate>
<dc:creator>davidjhinson</dc:creator>
<guid>http://davidjhinson.wordpress.com/2009/03/09/objective-c-and-http-basic-authentication/</guid>
<description><![CDATA[For all the really nice stuff Objective-C lets you do on the iPhone, there are many, many holes left]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>For all the really nice stuff Objective-C lets you do on the iPhone, there are many, many holes left for very common tasks.</p>
<p>One of those tasks is Base64 encoding.</p>
<p>Base64 encoding is used to convert binary data into text that can be transmitted using HTTP (like, say, for <a title="Embedding Images in Email Using Cocoa-Touch" href="http://davidjhinson.wordpress.com/2009/01/21/embedding-images-in-outbound-email-using-cocoa-touch/" target="_blank">embedding images in email</a>) or for somewhat obfuscating user ids and passwords to be sent &#8220;in the clear&#8221; over HTTP (like for Basic Authentication).</p>
<p>Without much further ado, I present one of a gagillion implementations of Base64 encoding in C:</p>
<blockquote><p><code>static char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"<br />
"abcdefghijklmnopqrstuvwxyz"<br />
"0123456789"<br />
"+/";</code></p>
<p><code>int encode(unsigned s_len, char *src, unsigned d_len, char *dst)<br />
{<br />
unsigned triad;</code></p>
<p><code>for (triad = 0; triad &#60; s_len; triad += 3)<br />
{<br />
unsigned long int sr;<br />
unsigned byte;</code></p>
<p><code>for (byte = 0; (byte&#60;3)&#38;&#38;(triad+byte&#60;s_len); ++byte)<br />
{<br />
sr &#60;&#60;= 8;<br />
sr &#124;= (*(src+triad+byte) &#38; 0xff);<br />
}</code></p>
<p><code>sr &#60;&#60;= (6-((8*byte)%6))%6; /*shift left to next 6bit alignment*/</code></p>
<p><code>if (d_len &#60; 4) return 1; /* error - dest too short */</code></p>
<p><code>*(dst+0) = *(dst+1) = *(dst+2) = *(dst+3) = '=';<br />
switch(byte)<br />
{<br />
case 3:<br />
*(dst+3) = base64[sr&#38;0x3f];<br />
sr &#62;&#62;= 6;<br />
case 2:<br />
*(dst+2) = base64[sr&#38;0x3f];<br />
sr &#62;&#62;= 6;<br />
case 1:<br />
*(dst+1) = base64[sr&#38;0x3f];<br />
sr &#62;&#62;= 6;<br />
*(dst+0) = base64[sr&#38;0x3f];<br />
}<br />
dst += 4; d_len -= 4;<br />
}</code></p>
<p><code>return 0;</code></p>
<p><code>}</code></p></blockquote>
<p>And here is how one may transmit a user id and password (using NSURLConnection) to establish a connection using Basic Authentication:</p>
<blockquote><p><code>myApp.loginString    = (NSMutableString*)[[NSUserDefaults standardUserDefaults] stringForKey:kloginKey];<br />
myApp.passwordString = (NSMutableString*)[[NSUserDefaults standardUserDefaults] stringForKey:kpasswordKey];</code></p>
<p><code>NSMutableString *dataStr = (NSMutableString*)[@"" stringByAppendingFormat:@"%@:%@", myApp.loginString, myApp.passwordString];</code></p>
<p><code>NSData *encodeData = [dataStr dataUsingEncoding:NSUTF8StringEncoding];<br />
char encodeArray[512];</code></p>
<p><code>memset(encodeArray, '&#92;0', sizeof(encodeArray));</code></p>
<p><code>// Base64 Encode username and password<br />
encode([encodeData length], (char *)[encodeData bytes], sizeof(encodeArray), encodeArray);</code></p>
<p><code>dataStr = [NSString stringWithCString:encodeArray length:strlen(encodeArray)];<br />
myApp.authenticationString = [@"" stringByAppendingFormat:@"Basic %@", dataStr];</code></p>
<p><code>// Create asynchronous request<br />
NSMutableURLRequest * theRequest=(NSMutableURLRequest*)[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://www.somewebdomain.com"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];<br />
[theRequest addValue:myApp.authenticationString forHTTPHeaderField:@"Authorization"];</code></p>
<p><code>NSURLConnection * theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];</code></p>
<p><code>[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;<br />
if (theConnection) {<br />
receivedData = [[NSMutableData data] retain];<br />
}<br />
else {<br />
[myApp addTextToLog:@"Could not connect to the network" withCaption:@"MyApp"];<br />
}</code></p></blockquote>
<p>Hopefully, this will help people get cracking that were having a hard time getting a handle on the fact that Objective-C is really C &#8211; albeit with funky class extensions.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
