<?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>Software Development blog by Aman &#187; iPhone App Development</title>
	<atom:link href="http://amanpages.com/category/iphone-app-development-core-sdk-cocoa/feed/" rel="self" type="application/rss+xml" />
	<link>http://amanpages.com/wordpress</link>
	<description>Pages written by a software enthusiastic on iPhone app development, ActionScript, PHP or anything that make me interested to play with!</description>
	<lastBuildDate>Mon, 09 Jan 2012 11:09:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Multiple login for TwitterAgent</title>
		<link>http://amanpages.com/wordpress/sample-iphone-example-project/multiple-login-for-twitteragent/</link>
		<comments>http://amanpages.com/wordpress/sample-iphone-example-project/multiple-login-for-twitteragent/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 11:33:12 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[Example Project]]></category>
		<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[twitteragent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=187</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>I received some requests on multiple login option for TwitterAgent and updated the agent there by. Now a logout option is added to login again with a different userid.]]></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%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fmultiple-login-for-twitteragent%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fmultiple-login-for-twitteragent%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><blockquote>
<div id="_mcePaste">XAuth was not used in my classes,  hope to integrate soon.</div>
<div id="_mcePaste">Till then please use this: https://github.com/vodkhang/Twitter-XAuth-and-Sharing</div>
<div id="_mcePaste">Vodkhang used the UI used in TwitterAgent with XAuth.</div>
<p>XAuth was not used in my classes,  hope to integrate soon.<br />
Till then please use this: https://github.com/vodkhang/Twitter-XAuth-and-SharingVodkhang used the UI used in TwitterAgent with XAuth.</p></blockquote>
<p>TwitterAgent is updated and a new feature is added by your request. I received some requests on multiple login option for TwitterAgent and updated the agent there by. Now a logout option is added to login again with a different userid.</p>
<h2>Add twitter agent code to your project</h2>
<p>You can checkout the latest code from the google project or can use the folder available in attached demo project below.<br />
Paste the xutils folder into your project directory.</p>
<p>Now, right click on the project in xcode and add the xutils folder.</p>
<h2>Add SBJSON</h2>
<p>SBJSON is also required for the project. You can have one copy of sbjson source in the attached project.</p>
<h2>Add twit code</h2>
<p>Add a button and in its event handler method add the following lines:</p>
<pre class="c++">[[TwitterAgent defaultAgent] twit];</pre>
<p>After logging in, you will find a new button available on top right corner, that is the logout button!</p>
<div id="attachment_188" class="wp-caption alignnone" style="width: 290px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/04/twitter-agent-logout-option.png"><img class="size-full wp-image-188" title="twitter-agent-logout-option" src="http://amanpages.com/wordpress/wp-content/uploads/2010/04/twitter-agent-logout-option.png" alt="" width="280" height="213" /></a><p class="wp-caption-text">TwitterAgent Logout option</p></div>
<p>On the next version, there will be option to manage batch twit account! Don&#8217;t forget to check back soon!</p>
<blockquote><p><a title="Twitter-Agent-Logout-Example" href="http://amanpages.com/wordpress/wp-content/uploads/2010/04/TwitterAgentLogoutExample.zip">Download Demo project</a></p></blockquote>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fmultiple-login-for-twitteragent%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fmultiple-login-for-twitteragent%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/sample-iphone-example-project/multiple-login-for-twitteragent/"></a></div><fb:share-button href="http://amanpages.com/wordpress/sample-iphone-example-project/multiple-login-for-twitteragent/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/sample-iphone-example-project/multiple-login-for-twitteragent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>FacebookAgent Update: Easily Run FQL, get User info, get/set permission and friend list!</title>
		<link>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list/</link>
		<comments>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 20:45:26 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[facebookagent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=175</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>Now support for FQL, friendlist, userinfo is added! You can also give permission and get permission matrix. Additionally, a shared object is introduced so you can use facebook agent easily on multiple view controllers!]]></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%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><blockquote><p><strong>GET THE LATEST CODE FROM HERE:<a href=" http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/"> http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/</a><br />
PLEASE JOIN THE PROJECT</strong></p>
<p><strong> </strong></p>
<div id="_mcePaste"></div>
<p><strong><em><span style="color: #ff0000;">This project is now obsolete since I found facebook released a great class!!check out here : http://github.com/facebook/facebook-ios-sdk</span></em></strong></p></blockquote>
<p>I am very grateful to all you people who posted feedback, mailed me inspiring notes and now reading the blog <img src='http://amanpages.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Some of you were asking for shared object support so that <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">facebook agent</a> can be used from multiple view controllers. I really liked the idea and  shared object is introduced in this release.</p>
<p>Besides, I have been invited to be a co-author on a new book by <a href="http://hasin.wordpress.com/">Hasin Hayder</a>. This book will be on facebook connect and I will contribute the iphone integration chapter. I was really honored and thought to implement some more features in <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">facebookagent</a> and now there is option to get user info, friendlist and also you can now run fql <img src='http://amanpages.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is a short description how to use in new way.</p>
<p>Firstly, On the AppDelegate class, initialize <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">facebookagent</a> shared object on applicationdidfinishlaunching method:</p>
<pre class="c++">- (void)applicationDidFinishLaunching:(UIApplication *)application {
	[[FacebookAgent sharedAgent] initializeWithApiKey:@"YOUR API KEY"
	ApiSecret:@"YOUR_API SECRET"
	ApiProxy:nil];
 ...
...
...
}</pre>
<p>Now, set the <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">facebookagent</a> delegate to the view controller object in which you want to call a function:</p>
<pre class="c++">[[FacebookAgent sharedAgent] setDelegate:self];</pre>
<p>Then call the function you wish:</p>
<pre class="c++">	[[FacebookAgent sharedAgent] publishFeedWithName:@"Hellow world"
	captionText:@"how are you?"
	imageurl:@"http://amanpages.com/wordpress/wp-content/uploads/2009/12/logo2.png"
	linkurl:@"http://amanpages.com/"
	userMessagePrompt:@"What do i think:"];</pre>
<p>Don&#8217;t forget to override the FacebookAgentDelegate method in the view controller class.</p>
<p>Some new delegate method is added like:</p>
<pre class="c++">- (void) facebookAgent:(FacebookAgent*)agent permissionGranted:(FacebookAgentPermission)permission;
- (void) facebookAgent:(FacebookAgent*)agent didLoadFQL:(NSArray*) data;
- (void) facebookAgent:(FacebookAgent*)agent didLoadPermissions:(NSArray*) data;
- (void) facebookAgent:(FacebookAgent*)agent didLoadInfo:(NSDictionary*) info;
- (void) facebookAgent:(FacebookAgent*)agent didLoadFriendList:(NSArray*) data onlyAppUsers:(BOOL)yesOrNo;</pre>
<p>And some new <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">facebookagent</a> function is also added:</p>
<pre class="c++">- (void)getMyFriendList:(BOOL)onlyAppUsers;
- (void)getPermissions;
- (void)grantPermission:(FacebookAgentPermission)type;
- (void)runFQL:(NSString*)fql;
- (BOOL)hasPermission:(FacebookAgentPermission)type;

- (NSString*)getUserName;
- (NSString*)getUserProfileSquareImage;
- (NSString*)getUserProfileImage;</pre>
<p>I will be adding detailed tutorial soon, till then is it. Check out the code from <a href="http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/"><img src="http://www.gstatic.com/codesite/ph/images/defaultlogo.png" alt="iphone-facebook-twitter-connect-easy-integration-tool" />google project</a>.</p>
<p>Personally I created a UIViewController subclass where all the delegate methods are added. Then extended this class by all the viewcontrollers needing <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone">facebook agent</a> and overridden the required ones only.</p>
<p>I will really appreciate if you join this project and give any sort of update, bug report or even feedback.</p>
<p>Btw, do I need to mention again:<br />
PLEASE REMEMBER THESE CODE IS NOT FULLY TESTED ON DEVICES AND MAY CRASH, USE IT ON YOUR OWN RISK!</p>
<p>Cheers.</p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list/"></a></div><fb:share-button href="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-easily-run-fql-get-user-info-getset-permission-and-friend-list/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>FacebookAgent and TwitterAgent now on Google code</title>
		<link>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-and-twitteragent-now-on-google-code/</link>
		<comments>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-and-twitteragent-now-on-google-code/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 07:57:44 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[facebookagent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=156</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>FacebookAgent and TwitterAgent classes are released as Open Source project in google code. You are welcome to join the project... any update or bug report is highly appreciated.]]></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%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-and-twitteragent-now-on-google-code%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-and-twitteragent-now-on-google-code%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><p>For my personal use I wrote few classes for sharing feeds on facebook and twitter. Though these classes are not well tested yet but I shared them from this site.</p>
<p>I was very excited and inspired by many people who used it, thanked me, reported bugs and even some gave me fixes with feature idea. I gratefully thank them all.</p>
<p>Now, I think if I alone want to maintain these code, it may not be good enough. So I ask for your help. Please join this project and lets help many other people who are using it including ourselves.</p>
<p>If you are interested to join, visit the the project on google code:<a href="http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/">http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/</a></p>
<p><a href="http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/"><img alt="" src="http://www.gstatic.com/codesite/ph/images/defaultlogo.png" title="Facebook Twitter Integrate to iPhone" class="alignnone" width="48" height="48" /></a></p>
<p>You can also send me private message to my email address which can be found on the project home.</p>
<p>Thanks for your perticipation <img src='http://amanpages.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-and-twitteragent-now-on-google-code%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-and-twitteragent-now-on-google-code%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-and-twitteragent-now-on-google-code/"></a></div><fb:share-button href="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-and-twitteragent-now-on-google-code/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-and-twitteragent-now-on-google-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone IBoutlet should be released manually ?</title>
		<link>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-iboutlet-should-be-released-manually/</link>
		<comments>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-iboutlet-should-be-released-manually/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 10:47:00 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[iPhone App Development]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=144</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>If you google this question, you will find many answers. Some says yes, some says no. Here I am showing the what should be done with the help of instrument ObjectAlloc graph.]]></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%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-iboutlet-should-be-released-manually%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-iboutlet-should-be-released-manually%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><p>If you google this question, you will find many answers. Some says yes, some says no. Here I am showing the results using instrument ObjectAlloc graph.</p>
<p><em><strong>Background:</strong></em></p>
<p>I have to use a view controller with a xib. The xib should have a button which need to be connected to an outlet in the view controller.</p>
<p><em><strong>Best Practice:</strong></em></p>
<p>In the view controller .h file, declare a UIButton* and a property like below:</p>
<pre class="c++" name="code">

UIButton* btnButton;

...

@property(nonatomic, retain) IBOutlet UIButton* btnButton;

in the .m file synthesize and release the button in the dealloc function like:

@sysnthesize btnButton

...

- (void) dealloc{

btnButton =nil;

[super release];

}
</pre>
<p>Now, using in the interface builder connect the button.</p>
<p><strong><em>What happens now:</em></strong></p>
<p>As said in the apple <a href="http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html">documentation</a> :</p>
<blockquote><p>Each time you ask the NSBundle or NSNib class to load a nib file, the underlying code creates a new copy of the objects in that file and returns them to you. The nib-loading code does not recycle nib file objects from a previous load attempt. Because each set of objects is a new copy, your code is responsible for releasing those objects when it is done with them. How you release the objects depends on the platform and on the memory model in use. Table 2-1 lists the supported platform and memory model configurations and the nib retention behavior associated with each one.</p>
<p>&#8230;bla bla&#8230;</p>
<p>Objects in the nib file are created with a retain count of 1 and then autoreleased. As it rebuilds the object hierarchy, however, UIKit reestablishes connections between the objects using the setValue:forKey: method, which uses the available setter method or retains the object by default if no setter method is available. If you define outlets for nib-file objects, you should also define a setter method for accessing that outlet. Setter methods for outlets should retain their values, and setter methods for outlets containing top-level objects must retain their values to prevent them from being deallocated. If you do not store the top-level objects in outlets, you must retain either the array returned by the loadNibNamed:owner:options: method or the objects inside the array to prevent those objects from being released prematurely.</p></blockquote>
<p><em><strong>How we practice often:</strong></em></p>
<p>In the view controller .h file, declare a UIButton* and a property like below:</p>
<pre class="c++" name="code">

IBOutlet UIButton* btnButton;

in the .m file synthesize and release the button in the dealloc function like:

- (void) dealloc{

[btnButton release]; // should we need to do this?!!

[super release];

}
</pre>
<p><strong><em>What&#8217;s the question?!!</em></strong></p>
<p>The question is that if we really need to release the btnButton in the dealloc method.</p>
<p>well, we can go on discussion and ultimately we may find that YES, we need to. The outlets should be released in the dealloc. Backing up this conclusion I created a simple project with two view controller one having 6 button connected as mentioned last.</p>
<p>If we  release in the dealloc method, we can see that memory foot print remains the same after closing the last view.</p>
<div id="attachment_145" class="wp-caption alignnone" style="width: 267px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/02/Picture-10.png"><img class="size-full wp-image-145" title="outlest are released in the dealloc method" src="http://amanpages.com/wordpress/wp-content/uploads/2010/02/Picture-10.png" alt="" width="257" height="159" /></a><p class="wp-caption-text">outlest are released in the dealloc method</p></div>
<p>Now, if we don&#8217;t release the outlets or simply assign them nil value we will find memory footprint is increased! See the image below:</p>
<div id="attachment_148" class="wp-caption alignnone" style="width: 278px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/02/Picture-12.png"><img class="size-full wp-image-148" title="outlets are assigned nil value or not released" src="http://amanpages.com/wordpress/wp-content/uploads/2010/02/Picture-12.png" alt="" width="268" height="123" /></a><p class="wp-caption-text">outlets are not released or assigned nil value</p></div>
<p><em><strong>Conclusion:</strong></em></p>
<p>We better release the outlets in the dealloc method.</p>
<p>Actually rom the memory management point of view, it doesn&#8217;t matter whether you use property or instance variable of IBOutlet. In fact,<br />
IBOutlet does nothing but a help to the Interface builder finding the connectors. Behind the seen, same thing happens for both the way, so you have to release any outlets in the dealloc method.</p>
<p>Download  the <a href="http://amanpages.com/wordpress/wp-content/uploads/2010/02/nibtest.zip">Sample Project demonstrating memory footprint for  outlets</a>.</p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-iboutlet-should-be-released-manually%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-iboutlet-should-be-released-manually%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-iboutlet-should-be-released-manually/"></a></div><fb:share-button href="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-iboutlet-should-be-released-manually/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-iboutlet-should-be-released-manually/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>TwitterAgent Tutorial : Tweet from iPhone app in one line code with auto tinyURL</title>
		<link>http://amanpages.com/wordpress/sample-iphone-example-project/twitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl/</link>
		<comments>http://amanpages.com/wordpress/sample-iphone-example-project/twitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:32:02 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[Example Project]]></category>
		<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[twitteragent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=111</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>Integrate Twitter from you iPhone application using TwitterAgent. With TwitterAgent, you can do it by single line of code! Also you can auto shorten any url using tinyURL and attach with past just passing one extra parameter!]]></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%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ftwitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ftwitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><blockquote><p><strong> </strong></p>
<div id="_mcePaste"><strong>XAuth was not used in my classes,  hope to integrate soon.</strong></div>
<div id="_mcePaste"><strong>Till then please use this:<a href=" https://github.com/vodkhang/Twitter-XAuth-and-Sharing"> https://github.com/vodkhang/Twitter-XAuth-and-Sharing</a></strong></div>
<div id="_mcePaste"><strong>Vodkhang used the UI used in TwitterAgent with XAuth</strong></div>
</blockquote>
<p>Perhaps, you have used the <a href="http://amanpages.com/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/">FacebookAgent</a> in your apps. I gratefully thank the fellows from  <a href="http://iphonedevsdk.com/" target="_blank">iphonedevsdk.com</a> and other iPhone developers who mailed me saying the class helped them. These are actual inspiration of sharing code with all.</p>
<p>Now, I would like to share my TwitterAgent class with you. Using TwitterAgent you can now integrate twitter in your iPhone app seamlessly. Additionally, you can also specify a URL and can make it tinyURL on the fly just passing an extra parameter!</p>
<p>Here are the steps:</p>
<p>1. Download <a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/TwitterAgent.zip">TwitterAgent</a> and <a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/BusyAgent.zip">BusyAgent</a> and add them into your project.</p>
<p>2. Import TwitterAgent.h in the file where we want to use</p>
<p>3. Now call any of these function, they are self explanatory!</p>
<pre class="c++">[[TwitterAgent defaultAgent] twit ];

[[TwitterAgent defaultAgent] twit:@"Search with google!" ];

[[TwitterAgent defaultAgent] twit:@"Search with google!" withLink:@"http://www.google.com" makeTiny:NO];

[[TwitterAgent defaultAgent] twit:@"Search with google!" withLink:@"http://www.google.com" makeTiny:YES];</pre>
<p>Screenshots:</p>
<div id="attachment_112" class="wp-caption alignnone" style="width: 294px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-1.png"><img class="size-full wp-image-112" title="Login To Twitter" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-1.png" alt="" width="284" height="198" /></a><p class="wp-caption-text">Login To Twitter</p></div>
<p>You only need to login once in one session. Login information will be saved to the device and will be used next time the application starts.</p>
<p><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-7.png"><img class="size-full wp-image-113 " title="[[TwitterAgent defaultAgent] twit];" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-7.png" alt="" width="292" height="233" /></a></p>
<pre class="c++">[[TwitterAgent defaultAgent] twit];</pre>
<p><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-6.png"><img class="size-full wp-image-114 " title="twit with message" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-6.png" alt="" width="289" height="227" /></a></p>
<pre class="c++">[[TwitterAgent defaultAgent] twit:@"Search with google!"];</pre>
<p><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-8.png"><img class="size-full wp-image-115" title="Twit with message and URL" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-8.png" alt="" width="286" height="223" /></a></p>
<pre class="c++">[[TwitterAgent defaultAgent] twit:@"Search with google!" withLink:@"http://www.google.com" makeTiny:NO];</pre>
<p><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-5.png"><img class="size-full wp-image-117" title="Twit with message and tiny url" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-5.png" alt="" width="287" height="225" /></a></p>
<pre class="c++">[[TwitterAgent defaultAgent] twit:@"Search with google!" withLink:@"http://www.google.com" makeTiny:YES];</pre>
<p>Hope it will come into your help. Cheers!</p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ftwitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ftwitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/sample-iphone-example-project/twitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl/"></a></div><fb:share-button href="http://amanpages.com/wordpress/sample-iphone-example-project/twitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/sample-iphone-example-project/twitteragent-tutorial-tweet-from-iphone-app-in-one-line-code-with-auto-tinyurl/feed/</wfw:commentRss>
		<slash:comments>88</slash:comments>
		</item>
		<item>
		<title>FacebookAgent update: Now upload a photo and then change status in a single call using Facebook connect for iPhone</title>
		<link>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/</link>
		<comments>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 20:11:41 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[facebookagent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=79</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>Using facebook connect for iPhone you can now upload a photo and then change user status by calling a single method of FacebookAgent!]]></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%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><blockquote><p><strong>GET THE LATEST CODE FROM HERE:<a href=" http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/"> http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/</a><br />
PLEASE JOIN THE PROJECT<br />
</strong></p></blockquote>
<p>In my <a href="http://amanpages.com/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/">previous post</a> I shared a FacebookAgent to simplify  integrating Facebook connect in iPhone and using common actions without<br />
handling login, permission check etc but in a single method call like:</p>
<ul>
<li>Publish feed</li>
<li>Change status</li>
<li>Upload photo</li>
</ul>
<div>Scotopia from iphonedevsdk.com shared an <a title="URL to the post at iphonedevsdk.com" href="http://www.iphonedevsdk.com/forum/iphone-sdk-tools-utilities/37318-simple-way-integrate-facebook-reused-reduced-code-one-line-code-do-actions.html#post158868" target="_blank">excellent idea</a> of implementing a method which would upload a photo and then update status.</div>
<div>I have updated the FacebookAgent according to that. Now it has few more functions:</div>
<pre  name = "code" class="c++">
/**
 * Upload photo
 */
- (void) uploadPhoto:(NSString*)imageurl;
- (void) uploadPhotoAtURL:(NSString*)imageurl withCaption:(NSString*)captionOrNil toAlbum:(NSString*)aidOrNil;
- (void) uploadPhotoAsData:(NSData*)imagedata withCaption:(NSString*)captionOrNil toAlbum:(NSString*)aidOrNil;

/**
 * Upload photo with status
 */
- (void) uploadPhoto:(NSString*)imageurl withStatus:(NSString*)status;
- (void) uploadPhotoAtURL:(NSString*)imageurl withStatus:(NSString*)status caption:(NSString*)captionOrNil toAlbum:(NSString*)aidOrNil;
- (void) uploadPhotoAsData:(NSData*)imagedata withStatus:(NSString*)status caption:(NSString*)captionOrNil toAlbum:(NSString*)aidOrNil;

/**
 * Ask permission to auto approve uploaded photo and add photo to an album.
 */
- (void) askUplaoadPhotoToAlbumPermission;
</pre>
<div><a title="FacebokAgent, one call to upload photo and then change status by a single method!" href="http://www.amanpages.com/wordpress/wp-content/uploads/2010/01/FacebookAgent.zip">Download the update source code from here.</a></div>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Ffacebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/"></a></div><fb:share-button href="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/facebookagent-update-now-upload-a-photo-and-then-change-status-in-a-single-call-using-facebook-connect-for-iphone/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>FacebookAgent: Easy way to integrate facebook connect in iPhone Apps and write minimum code to publish feed, change status etc!</title>
		<link>http://amanpages.com/wordpress/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/</link>
		<comments>http://amanpages.com/wordpress/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:38:05 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[Example Project]]></category>
		<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[facebookagent]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=59</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>FacebookAgent: Use it to skip code rewrite, write less code, easy integration of facebook connect without any project settings change. Publish feed, change status, upload photo without writing code for login, extended permission etc!! Above all, use the source code freely without any restriction even for commercial purpose! Free and Open!]]></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%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ffacebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ffacebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><blockquote><p><strong>GET THE LATEST CODE FROM HERE:<a href=" http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/"> http://code.google.com/p/iphone-facebook-twitter-connect-easy-integration-tool/</a><br />
PLEASE JOIN THE PROJECT</strong></p>
<p><strong> </strong></p>
<div id="_mcePaste"><strong><em><span style="color: #ff0000;">This project is now obsolete since I found facebook released a great class!!</span></em></strong></div>
<div id="_mcePaste"><strong><em><span style="color: #ff0000;">check out here : http://github.com/facebook/facebook-ios-sdk</span></em></strong></div>
</blockquote>
<p>Today most of the applications we build have a common feature: Socialize! One common way to achieve this my integrating Facebook within the app.</p>
<p>In my earlier <a href="http://amanpages.com/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/">post</a> I have shared a helper class for paginating data. Today I will share how I integrate facebook connect in iPhone apps. I humble admit I am a lazy, if not busy, developer who doesn&#8217;t like to write same code again again.</p>
<p>For iPhone applications <a href="http://developers.facebook.com/connect.php">FacebookConnect</a> is the only way to integrate facebook social features. Facebook team has developed a sdk for iPhone. A sample code showing the use and integration of Facebook Connect in your application. This is quite simple and also tons of tutorials, forums, e-books and videos are out here on the web.</p>
<p>Well, I&#8217;m not gonna add few more grams on that! Rather I am going to share how I integrates facebook connects into my apps.</p>
<p>Firstly, let us see what are the steps to add facebook connect. You can also check out this tutorial on <a href="http://wiki.developers.facebook.com/index.php/Facebook_Connect_for_iPhone">facebook wiki</a> or watch the video <a href="http://vimeo.com/3616452">Implement Facebook Connect on the iPhone in 5 minutes</a>.</p>
<p>Basically the steps for publishing a feed are:</p>
<p>1. Download the <a href="http://github.com/facebook/facebook-iphone-sdk/">sdk</a>.</p>
<p>2. Add the connect source file in your project.<br />
project<br />
3. Update the  settings to make FBConnect.h in you header path.</p>
<p>4. In the controller class, have session member variable, many delegate methods.</p>
<p>5. Have a login button to show the login prompt.</p>
<p>6. Once logged in, prepare an attachment json string and show the feed dialog.</p>
<p>These steps are quite simple but if you are a busy programmer and need to work on many projects these steps may be little bothering since you have to rewrite all the codes for loggin in, showing dialogs, handle login events etc.</p>
<p>So, I just encapsulated these repetitive work into a class named FacebookAgent and defined a simple protocol to work on.</p>
<p>Lets see how we can use it.</p>
<p><strong>Objective</strong>: Create a simple view based application and publish a feed using FacebookAgent.</p>
<p>1. Download this folder     <a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/FacebookAgent.zip">FacebookAgent.zip</a>.</p>
<p>It also includes facebook connect sdk. So you don&#8217;t need to add this sdk elsewhere or even update any project settings for this purpose.</p>
<p>2. Create a new project, name it FacebookAgentTest. Righ click on the project in the XCode and select Add existing files. Add the FacebookAgent Folder to your classes. Check copy the source files.</p>
<div id="attachment_66" class="wp-caption alignnone" style="width: 310px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-22.png"><img class="size-medium wp-image-66" title="Add FacebookAgent folder to your project" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-22-300x283.png" alt="" width="300" height="283" /></a><p class="wp-caption-text">Add FacebookAgent folder to your project</p></div>
<p>3.  In the FacebookAgentTestViewController.h, import FacebookAgent.h and implement protocol FacebookAgentDelegate.</p>
<pre class="c++">@interface FacebookAgentTestViewController : UIViewController {
...</pre>
<p>4. Declare a member variable of type FacebookAgent.</p>
<pre class="c++">FacebookAgent* fbAgent;</pre>
<p>5. Open FacebookAgentTest.m and initialize fbAgent in viewDidLoad method.</p>
<pre class="c++">fbAgent = [[FacebookAgent alloc] initWithApiKey:@"PLACE YOUR FACEBOOK APPLICATION API KEY"
										  ApiSecret:@"PLACE YOUR FACEBOOK APPLICATION API SECRET"
										   ApiProxy:nil];
	fbAgent.delegate = self;</pre>
<p>6. Declare an IBAction method in the FacebookAgentTest.h file.</p>
<pre class="c++">-(IBAction)updateStatus:(id)sender;</pre>
<p>7. Define the above method in FacebookAgentTest.m file.</p>
<pre class="c++">-(IBAction)updateStatus:(id)sender{
}</pre>
<p>8. Open FacebookAgentTestViewController.xib and add a button in the view and connect the above method on its touchesUpInside signal.</p>
<p><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-23.png"><img class="alignnone size-medium wp-image-67" title="Picture 23" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-23-300x219.png" alt="" width="300" height="219" /></a></p>
<p>9. Now just add the following lines in the updateStatus method to publish a feed!</p>
<pre class="c++">-(IBAction)updateStatus:(id)sender{
[fbAgent publishFeedWithName:@"Hellow world"
					 captionText:@"how are you?"
						imageurl:@"http://amanpages.com/wordpress/wp-content/uploads/2009/12/logo2.png"
						 linkurl:@"http://amanpages.com/"
			   userMessagePrompt:@"What do you think:"];
}</pre>
<p>This code will first check if the user is logged in. If logged in it will show the feed dialog.<br />
If the user is not logged in already, first the login dialog will be shown, after logging in, the feed dialog will be shown automatically!</p>
<p>But one minute, there is one require method in the FacebookAgentDelegate protocol. So, you need to define this:</p>
<pre class="c++">- (void) facebookAgent:(FacebookAgent*)agent loginStatus:(BOOL) loggedIn{
}</pre>
<p>Above method is called when the user logs in or logs out of the facebook. If you use any login button which is very likely, you may change the button title here.</p>
<p>10. Try updating your status. For this use this line:</p>
<pre class="c++">[fbAgent setStatus:@"status from iPhone 1"];</pre>
<p>This will first check if the user is logged in. if not logged in, then it will show the login prompt first.<br />
After log in it will check if extended permission is enabled for this app. if not it will show the permission dialog.<br />
Having given the permission, it will change the user status.</p>
<p>BUT.</p>
<p>11. You need to two more FacebookAgentDelegate method if you want to change status:</p>
<pre class="c++">- (void) facebookAgent:(FacebookAgent*)agent requestFaild:(NSString*) message{
}
- (void) facebookAgent:(FacebookAgent*)agent statusChanged:(BOOL) success{
}</pre>
<p>12. Thats all <img src='http://amanpages.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Run the app!</p>
<p>You can look into the FacebookAgent.h for more detail. It is well documented. If you still have some question shoot here or drop me mail.<br />
Feel free to use this classes without any restriction but I will appreciate if you let me know in which app you are using it <img src='http://amanpages.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What can be done now using FacebookAgent:<br />
1. Fetch user name:<br />
For this after initialization, set shouldFetchUsernameAfterLogin = YES.</p>
<pre class="c++">fbAgent.shouldFetchUsernameAfterLogin = YES</pre>
<p>and also define the corresponding delegate method:</p>
<pre class="c++">- (void) facebookAgent:(FacebookAgent*)agent didLoadName:(NSString*) name{
    //use the name
}</pre>
<p>2. Make your own attachment and publish a feed.</p>
<pre class="c++">// this method has some over loaded versions too
- (void) publishFeed:(NSString*)attachement;</pre>
<p>3. Publish feed by passing, name, caption, image and link url.</p>
<pre class="c++">// this method has some over loaded versions too
/**
 * Let the agent make attachement for you. You just pass the information
 *
 */
- (void) publishFeedWithName:(NSString*)name
			 captionText:(NSString*)caption
					   imageurl:(NSString*)url
						linkurl:(NSString*)href
			  userMessagePrompt:(NSString*)prompt;</pre>
<p>4.  upload a photo</p>
<pre class="c++">- (void) uploadPhoto:(NSString*)imageurl;</pre>
<p>6. ask for extended permission</p>
<pre class="c++">- (void) askPermission;</pre>
<p>7. login and logout</p>
<pre class="c++">- (void) login;
- (void) logout;</pre>
<p>The delegates also offers some handy callback options like:</p>
<pre class="c++">/**
 * Must define this method if setStatus is called
 *
 * This method is called when user status is changed either successfully or not
 */
- (void) facebookAgent:(FacebookAgent*)agent statusChanged:(BOOL) success;

/**
 * Must define this method if shouldFetchUsernameAfterLogin is set YES
 *
 * This method is called after the agent fetched facebook profile name
 */
- (void) facebookAgent:(FacebookAgent*)agent didLoadName:(NSString*) name;

/**
 * Must define this method if uploadPhoto is called
 *
 * This method is called after photo is uploaded
 */
- (void) facebookAgent:(FacebookAgent*)agent photoUploaded:(NSString*) pid;

/**
 * Must impement this method if any of the above method is defined
 *
 * This method is called if the agent fails to perform any of the above three actions
 */
- (void) facebookAgent:(FacebookAgent*)agent requestFaild:(NSString*) message;

@required

/**
 * This method is called if after login or logout
 */
- (void) facebookAgent:(FacebookAgent*)agent loginStatus:(BOOL) loggedIn;</pre>
<p>Here is the demo project. DONT FORGET TO ADD YOUR key and secret!!<br />
<a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/FacebookAgentTest.zip">FacebookAgentTest</a></p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ffacebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Ffacebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/"></a></div><fb:share-button href="http://amanpages.com/wordpress/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/sample-iphone-example-project/facebookagent-easy-way-to-integrate-facebook-connect-in-iphone-apps-and-write-minimum-code-to-publish-feed-change-status/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>iPhone app development life cycle with offshore development house</title>
		<link>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-app-development-life-cycle-with-offshore-development-house/</link>
		<comments>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-app-development-life-cycle-with-offshore-development-house/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 20:08:57 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[iPhone App Development]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=50</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>Answer your clients questions on iPhone app development life cycle, what they need to provide, why certificates are required, what are those etc.]]></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%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-app-development-life-cycle-with-offshore-development-house%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-app-development-life-cycle-with-offshore-development-house%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><p><strong><span style="color: #800000;">What is the iPhone app development cycle?</span></strong></p>
<p><strong><span style="color: #800000;">What is adhoc certificate?</span></strong></p>
<p><strong><span style="color: #800000;">What is distribution certificate?</span></strong></p>
<p><strong><span style="color: #800000;">How the client will test the app?</span></strong></p>
<p><strong><span style="color: #800000;">Can</span><em><span style="color: #800000;"> iPhone apps be distributed downloaded from my website?</span></em></strong></p>
<p><span style="color: #800000;">&#8230;.</span></p>
<p>Similar questions are often asked to us, the iPhone developers.  One of my friend runs a software house. His main focus is on developing web applications for his offshore clients. Recently he focused on developing iPhone application.</p>
<p>Few days back he calls me up and started asking questions similar to those. Actually those were asked to him and he sought answer to me. Well, he was not the first to ask me such question and for last couple of weeks I had to answer these questions to many( well if you say 5/6 many) people.</p>
<p>But he was sick for few days and requested me to write answer for his client on behalf him.</p>
<p>So did I.</p>
<p>Now, I think it is better to share with everyone&#8230; at least I can point to this post for such questions in future!</p>
<p>Here it goes:</p>
<p>*******</p>
<p>Here is the iPhone app development cycle and required communication between you and us.</p>
<p>Stakeholders:<br />
1. iPhone App Developer( &#8220;Dev&#8221; i.e. us)<br />
2. iPhone app seller (&#8220;Client&#8221; i.e. you)</p>
<p>Firstly, an iPhone cannot be run on any iphone/ipod if it is not downloaded from itunes app-store and then installed to iphone/ipod by syncing( same as syncing music, pics etc. via iTunes).</p>
<p>Dev is a registered Apple Developer. He also registered his iPhone,iPod to Apple and apple in return gave him a certificate. Using this certificate<br />
he can use his devices as debugger only when the devices are connected to his Mac machine using XCode IDE.</p>
<p>Clients or sellers need to register in any of the ADC programs. For example we have a registered standard program account i.e. we can also sell free/paid from iTunes along with development.</p>
<p>Now, how the Client will test/run the app? For this also, Client need to register http://developer.apple.com/iphone/program/ in a program standard/enterprise.</p>
<p>Then, from the control panel he need create certificate with his device ids( device id can be seen via itunes once connected, we can show you if u need).</p>
<p>After that, he has to send this certificates to the Developer. This is called AdHoc certificate. Using this certificate an app can run on those registered devices.</p>
<p>Now, the Developer will install the certificate on his Mac and make an app executable using this adhoc certificate. Then, he will mail this app/executable to the client.</p>
<p>The client will download the app and drag it on itunes and then sync his iphone/ipod.</p>
<p>But, this executable cannot be submitted to app-store and also wont run any other devices other than the ones registered in the AdHoc certificate.</p>
<p>To submit any app to app-store i.e. to sell/distribute an app using app-store, the executable must be compiled with with a Distribution certificate.<br />
Distribution certificate is to created by the seller i.e. the client. It is similar to creating  adhoc certificate.  At this moment client must provide an app icon to the developer.</p>
<p>Then the client again send the distribution certificate to the developer. Developer compiles another build with it and sends the app-build to the client.</p>
<p>Then the client will download this build and submit to itunes app-store.</p>
<p>Once you are registered to the ADC standard($100) or enterprise($299) program from here http://developer.apple.com/iphone/program/<br />
you will have a nice control panel. There are nice step by step guideline there.</p>
<p>****</p>
<p>So, in short:</p>
<p>1. Client Gives requirement to Developer</p>
<p>2. Developer develops the app</p>
<p>3. Client gives ad-hoc certificate to the developer.</p>
<p>4. Developer gives ad-hoc build to the client</p>
<p>5. Client Test the ad-hoc build on his iPhone/iPods</p>
<p>6. Client  gives the distribution certificate to the developer</p>
<p>7. Developer give distribution build to the client</p>
<p>8. Client submits this distribution build to app-store</p>
<p>9. App-Store takes around 1 week to review and then make it available on iTunes App-Store</p>
<p>Btw, the Client must also provide AppIcon or size 57px X 57px to the developer.</p>
<p>Client also need to have the same image of the AppIcon of size 512 X 512 to submit the app on app-store.</p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-app-development-life-cycle-with-offshore-development-house%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fiphone-app-development-core-sdk-cocoa%2Fiphone-app-development-life-cycle-with-offshore-development-house%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-app-development-life-cycle-with-offshore-development-house/"></a></div><fb:share-button href="http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-app-development-life-cycle-with-offshore-development-house/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/iphone-app-development-life-cycle-with-offshore-development-house/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Helper class for showing records with pagination for iPhone sdk app</title>
		<link>http://amanpages.com/wordpress/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/</link>
		<comments>http://amanpages.com/wordpress/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 14:02:01 +0000</pubDate>
		<dc:creator>Aman</dc:creator>
				<category><![CDATA[Example Project]]></category>
		<category><![CDATA[iPhone App Development]]></category>
		<category><![CDATA[helper]]></category>

		<guid isPermaLink="false">http://amanpages.com/?p=20</guid>
		<description><![CDATA[<img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/>A helper class for showing records in pages. This can be used for showing comments, shouts, recent news etc with some buttons like next, previous.]]></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%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fhelper-class-for-showing-records-with-pagination-for-iphone-sdk-app%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fhelper-class-for-showing-records-with-pagination-for-iphone-sdk-app%2F" height="61" width="51" /></a></div><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/samplecode.png" width="36" height="36" alt="" title="Example Project" /><img src="http://amanpages.com/wordpress//wp-content/uploads/icons/32_iphone.png" width="40" height="40" alt="" title="iPhone App Development" /><br/><p>We often need to add social features in our iPhone apps. Adding features like commenting, shouts etc are very common. These type of data are usually shown<br />
with pagination with buttons like next, previous etc.</p>
<p>To reduce the overhead of creating this functionality again and again we may encapsulate the common functions in a class. So did I for my applications.</p>
<p>I have created a class named PaginationAgent. After loading records it calls related methods of its delegate which should implement protocol PaginationAgentDeleagte.</p>
<p>Additionally two php files are needed. One to return the total number of records and another one is to fetch the page data. They must be named respectively as</p>
<ul>
<li> get_total_number_of_records.php</li>
<li>get_records.php</li>
</ul>
<p>Lets see an example.</p>
<p>First, I have created a simple view based project &#8220;Pagination&#8221; and designed the view as u see:</p>
<div id="attachment_21" class="wp-caption aligncenter" style="width: 265px"><a href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-21.png"><img class="size-medium wp-image-21 " title="Interface" src="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Picture-21-255x300.png" alt="" width="255" height="300" /></a><p class="wp-caption-text">Create a similar view using Interface Builder</p></div>
<p>1. Added a button to show previous page data</p>
<p>2. One button to reload the data.</p>
<p>3. Another to show data on next page.</p>
<p>4. Added a UITable which will show the result.</p>
<p>In PaginationViewController.h, imported PaginationAgent.h file and declared:</p>
<pre name="code" class="c++">
PaginationAgent* objPagination;
</pre>
<p>Now lets see how to initialize it. In the viewDidLoad method I initialized this like this:</p>
<pre  name="code" class="c++">objPagination = [[PaginationAgent alloc] init];
objPagination.delegate = self;
objPagination.remoteApiBasePath = @"http://your.server/path/to/folder";</pre>
<p>remoteApiBasePath must be set to the location where the server side php files are placed.<br />
No trailing slash.</p>
<p>PaginationAgentDelegate protocol declares the following functions to be overridden by the Delegate:</p>
<pre  name="code" class="c++">/**
* This method is called when the busystate is changed.
* You can do something like disable/enable the buttons, grayout etc
* based on the isBusy value.
*/
-(void)paginationAgent:(PaginationAgent*)agent updateBusyMode:(BOOL)isBusy;

/**
* Called when total data count is received if shouldReloadAtFirstPage is set NO.
*/
-(void)paginationAgent:(PaginationAgent*)agent totalDataCountReceived:(int)dataCount;

/**
* Called when page data is loaded. You may set your table dataSource here and realod
* reload the table.
*/
-(void)paginationAgent:(PaginationAgent*)agent pageDataReceived:(NSArray*)data;

/**
* Called if server sends malformed data
*/
-(void)paginationAgent:(PaginationAgent*)agent onPaginationServerError:(NSString*)message;

/**
* Called if connection failed. It may occur due to poor or no internet connectivity
*/
-(void)paginationAgent:(PaginationAgent*)agent onPaginationConnectionError:(NSString*)message;</pre>
<p>The php files must return data in json format and must use the format as used:</p>
<pre  name="code" class="php">
<?

// get data from database

	$data = array('success'=>1,'message'=>'Success','data'=>33);
	echo json_encode($data);

?>
</pre>
<pre  name="code" class="php">
...
...
$data = array('success'=>1,'message'=>'Got data','data'=>$rows);

echo json_encode($data);
</pre>
<p>See the attached project for details. The php files are inside the folder &#8220;PHPFILES&#8221;.</p>
<p><a title="Pagination xCode project with PHP files" href="http://amanpages.com/wordpress/wp-content/uploads/2010/01/Pagination.zip">Pagination.zip</a></p>
<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fhelper-class-for-showing-records-with-pagination-for-iphone-sdk-app%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Famanpages.com%2Fwordpress%2Fsample-iphone-example-project%2Fhelper-class-for-showing-records-with-pagination-for-iphone-sdk-app%2F" height="61" width="51" /></a></div><div align="left" style="float:left;padding:5px 5px 0px 0px;"><a name="fb_share" type="button_count" share_url="http://amanpages.com/wordpress/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/"></a></div><fb:share-button href="http://amanpages.com/wordpress/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/" type="button_count"></fb:share-button>]]></content:encoded>
			<wfw:commentRss>http://amanpages.com/wordpress/sample-iphone-example-project/helper-class-for-showing-records-with-pagination-for-iphone-sdk-app/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

