<?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>Digicorp &#187; iPhone</title>
	<atom:link href="http://dev.digi-corp.com/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.digi-corp.com</link>
	<description>&#62;&#62; Developer Blog</description>
	<lastBuildDate>Wed, 22 Jun 2011 14:13:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Map, Camera, iPod Library and Facebook Connect with iPhone</title>
		<link>http://dev.digi-corp.com/2009/09/google-map-camera-ipod-library-and-facebook-connect-with-iphone/</link>
		<comments>http://dev.digi-corp.com/2009/09/google-map-camera-ipod-library-and-facebook-connect-with-iphone/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 07:45:41 +0000</pubDate>
		<dc:creator>pratik.joshi</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Camera]]></category>
		<category><![CDATA[Encoding Image]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[Google Map]]></category>
		<category><![CDATA[iPod Library]]></category>
		<category><![CDATA[MKMapView]]></category>
		<category><![CDATA[MKUserLocation]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1275</guid>
		<description><![CDATA[Displaying Google map The iPhone SDK 3.0 offers a class of map view in MapKit framework. You just need to declare an object of MKMapView and add it to your current view. MKMapView *mapview=[[MKMapView alloc]initWithFrame:(CGRectMake(0, -20, 320, 320))]; [self.view addSubview:mapview]; Now, to display the user location on map, I was trying to insert a pin [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1350" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/iphone_home.gif" alt="iphone_home" width="300" height="495" /></p>
<p><strong>Displaying Google map</strong></p>
<p>The iPhone SDK 3.0 offers a class of map view in MapKit framework. You just need to declare an object of MKMapView and add it to your current view.</p>
<p style="padding-left: 30px;"><span style="color: #993300">MKMapView *mapview=[[MKMapView alloc]initWithFrame:(CGRectMake(0, -20, 320, 320))];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">[self.view addSubview:mapview];</span></p>
<p>Now, to display the user location on map, I was trying to insert a pin annotation on map. Soon, I realized that was wrong approach. User location is meant for changing. It will be updated many time.</p>
<p>The solution for this was to use the MKUserLocation class object. The object of this class will return “Blue dot” of built-in Google map application on iPhone. It will also show animated circle with radius of probable range of user location.</p>
<p style="padding-left: 30px;"><span style="color: #993300">MKUserLocation *ulocation=[[MKUserLocation alloc]init];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">[mapview setShowsUserLocation:TRUE];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">[mapview addAnnotation:ulocation];</span></p>
<p>That&#8217;s it. You don&#8217;t need to worry any more about the current location of user. The ulocation object will change its co-ordinates and display the dot whenever the position is updated.</p>
<p><img class="alignnone size-full wp-image-1348" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/iPhoneMap.png" alt="iPhoneMap" width="470" height="254" /></p>
<p><strong>Sending encoded image</strong></p>
<p>You can send images to web service either by mail or by encoding it to string. I have used base64 encoding method to encrypt the image taken from iPhone camera and to send it to web service.</p>
<p>Generally, the image taken from iPhone camera is of very large size (800 kb to 2 mb). So, it may take very long time to encode the image.</p>
<p>I found another way to do the same thing. After taking the picture, you can display the image taken in full view of screen (320*480). Then take the screenshot at that stage and fetch the new image for encoding. In this way, you can make your encoding faster as this was the same picture taken using camera.</p>
<p>I have used following process to take the screenshot.</p>
<p style="padding-left: 30px;"><span style="color: #993300">UIWindow *screenWindow = [[UIApplication sharedApplication] keyWindow];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">UIGraphicsBeginImageContext(screenWindow.frame.size);</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">[screenWindow.layer renderInContext:UIGraphicsGetCurrentContext()];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">UIGraphicsEndImageContext();</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">NSData *screenshotPNG = UIImagePNGRepresentation(screenshot);</span></p>
<p>Now, since you have the image in screenshotPNG, you can encode it using your base64 method.</p>
<p style="padding-left: 30px;"><span style="color: #993300">NSString *dstring=[[NSString alloc]init];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">dstring=[self base64StringFromData:screenshotPNG length:[screenshotPNG length]];</span></p>
<p><strong> </strong></p>
<p><strong>Playing a specific song</strong></p>
<p>With iPhone SDK 3.0, we have the access to iPod library on iPhone. The apple documentation “<a href="http://developer.apple.com/iphone/library/documentation/Audio/Conceptual/iPodLibraryAccess_Guide/Introduction/Introduction.html">iPodLibraryAccess Guide</a>” covers most of the part needed for understanding this functionality. Here, I will describe how to play a specific song stored on iPhone.</p>
<p>Let&#8217;s assume our song name is in songtitle which is NSString. To begin, we need objects of</p>
<p style="padding-left: 30px;"><span style="color: #993300">MPMusicPlayerController and a MPMediaQuery.</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">MPMusicPlayerController* iPodMusicPlayer;</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">MPMediaQuery *everything = [[MPMediaQuery alloc] init];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">everything=[MPMediaQuery songQuery];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">NSArray *itemsFromGenericQuery = [everything items];</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">for (MPMediaItem *song in itemsFromGenericQuery)</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">{</span></p>
<p style="padding-left: 60px;"><span style="color: #993300">NSString *mysong = [song valueForProperty: MPMediaItemPropertyTitle];</span></p>
<p style="padding-left: 60px;"><span style="color: #993300">if([mysong isEqualToString:songtitle])</span></p>
<p style="padding-left: 60px;"><span style="color: #993300">{</span></p>
<p style="padding-left: 90px;"><span style="color: #993300">iPodMusicPlayer=[MPMusicPlayerController iPodMusicPlayer];</span></p>
<p style="padding-left: 90px;"><span style="color: #993300">[iPodMusicPlayer setNowPlayingItem:song];</span></p>
<p style="padding-left: 90px;"><span style="color: #993300">[iPodMusicPlayer play];</span></p>
<p style="padding-left: 90px;"><span style="color: #993300">break;</span></p>
<p style="padding-left: 60px;"><span style="color: #993300">}</span></p>
<p style="padding-left: 30px;"><span style="color: #993300">}</span></p>
<p><span style="color: #993300"> </span></p>
<p><strong>Using Facebook Connect on iPhone</strong></p>
<p><a href="http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone">Facebook Connect </a>used in iPhone lets user connect to their facebook account. I am facing one problem in maintaining session of facebook. The sample application provided with facebook sdk allows user to stay logged-in even if iPhone application is terminated. So, the user will not have to enter facebook account username and password next time.</p>
<p>We can know the status of user if he is logged in by using -</p>
<p style="padding-left: 30px;"><span style="color: #993366;">(void)dialogDidSucceed:(NSURL*)url  and – (void)sessionDidLogout:(FBSession*)session method from FBLoginDialog.m.</span></p>
<p>Whenever user logsin using facebook account, the session will stored using NSUserDefaults. We can know this by tracking -(void)save; method in FBSession.m file.</p>
<p>The save method in FBSession.m  stores 4 objects in userdefaults: FBUserId, FBSessionKey, FBSessionSecret and FBSessionExpires.</p>
<p>I am facing problem here. Whenever I try to resume previous session, using -(BOOL)resume; method in FBSession.m, I get correct userid, but rest of the values will be nil. i.e.session key, sesison secret and session expirary date are nil. So, I get one fatal error at that time saying: “attempt to insert nil value (key: session_key)”  I am still trying to find out the solution for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/09/google-map-camera-ipod-library-and-facebook-connect-with-iphone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iPhone Application Deployment Steps</title>
		<link>http://dev.digi-corp.com/2009/09/iphone-application-deployment-steps/</link>
		<comments>http://dev.digi-corp.com/2009/09/iphone-application-deployment-steps/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 07:24:10 +0000</pubDate>
		<dc:creator>vivek.navadia</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Code Signing]]></category>
		<category><![CDATA[Entitlements]]></category>
		<category><![CDATA[iPhone Deployment]]></category>

		<guid isPermaLink="false">http://dev.digi-corp.com/?p=1218</guid>
		<description><![CDATA[Following steps may help you deploying your application successfully on the device. Download your .mobileprovision and .cer certificates from developer.apple.com website. Add the certificates to your keychain in Mac. Add your mobile provision certificate in Xcode project. Drag the certificate to Xcode in left pane of window and drop there. Select the Project and go [...]]]></description>
			<content:encoded><![CDATA[<p>Following steps may help you deploying your application successfully on the device.</p>
<ul>
<li>Download      your .mobileprovision and .cer certificates from developer.apple.com      website.</li>
<li>Add      the certificates to your keychain in Mac.</li>
<li>Add      your mobile provision certificate in Xcode project. Drag the certificate      to Xcode in left pane of window and drop there.</li>
<li>Select the Project and go to Edit <strong>Project Settings</strong></li>
</ul>
<p><img class="alignnone size-full wp-image-1412" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/1_New.jpg" alt="1_New" width="456" height="325" /></p>
<ul>
<li>Select <strong>Build</strong> Tab</li>
<li>Select      Configuration as <strong>Release</strong></li>
<li>Go      to code signing</li>
<li>Add      your certificate in <strong>Any iPhone OS Device</strong> section</li>
<li>When      you add certificate in for Code Signing Identity, then it must be in list      of Any iPhone OS Device option.</li>
</ul>
<p><img class="alignnone size-full wp-image-1416" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/2.jpg" alt="2" width="466" height="512" /></p>
<ul>
<li>Follow      same steps for <strong>Debug</strong> configuration also.</li>
<li>Do      same change for <strong>Debug</strong> and <strong>Release</strong> configuration      in <strong>Edit Active Target “Project Name”</strong> setting also</li>
</ul>
<p><img class="alignnone size-full wp-image-1417" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/3.jpg" alt="3" width="459" height="323" /></p>
<ul>
<li>Edit      the <strong>ProjectName</strong>-info.plist file in resources group and change      the company name with yourcompany name on which you have registered your      certificate in following value com.<strong>digicorp</strong>.${PRODUCT_NAME:rfc1034identifier}      and save the project.</li>
</ul>
<p><img class="alignnone size-full wp-image-1418" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/4.jpg" alt="4" width="453" height="319" /></p>
<ul>
<li>To      solve invalid entitlement issue first right click on application and add      new file</li>
<li>Under      the iPhone OS select <strong>Code Signing</strong></li>
<li>Select      the <strong>Entitlements</strong></li>
<li>Make      sure it is saved as <strong>Entitlements.plist</strong></li>
</ul>
<p><img class="alignnone size-full wp-image-1415" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/5.jpg" alt="5" width="449" height="334" /></p>
<ul>
<li>Now      uncheck the box of get-task-allow property in <strong>Entitlements.plist</strong></li>
</ul>
<p><img class="alignnone size-full wp-image-1414" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/6.jpg" alt="6" width="438" height="308" /></p>
<ul>
<li>Set      the <strong>Any iPhone OS Device</strong> with saved entitlements      certificate under Code Signing Entitlements for Debug and Release      configuration.</li>
</ul>
<p><img class="alignnone size-full wp-image-1413" src="http://dev.digi-corp.com/wp-content/uploads/2009/08/7.jpg" alt="7" width="456" height="507" /></p>
<ul>
<li>Set      the device OS for which you want to deploy your application from top left      bar of <strong>Xcode window</strong>.</li>
<li>Save      the <strong>Project</strong> and Build it.</li>
</ul>
<p>It will successfully deploy your <strong>application</strong> on device.</p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.digi-corp.com/2009/09/iphone-application-deployment-steps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

