<?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>iOS Developers</title>
	<atom:link href="http://www.ios-developer.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ios-developer.net</link>
	<description>iOS Developer Resources</description>
	<lastBuildDate>Tue, 21 Feb 2012 09:22:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Transfering Files Via iTunes</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/file-transfer/transfering-files-via-itunes</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/file-transfer/transfering-files-via-itunes#comments</comments>
		<pubDate>Tue, 21 Feb 2012 08:36:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[File Transfer]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1111</guid>
		<description><![CDATA[Using iTunes and the USB cable can provide MUCH faster file transfers thn WiFi. To enable set IFileSharingEnabled key to true in Info.plist (note it is not a string) The file share directory When file sharing is enabled, the entire Documents folder is used for file sharing. Files that that are not intended for user [...]]]></description>
			<content:encoded><![CDATA[<p>Using iTunes and the USB cable can provide MUCH faster file transfers thn WiFi.</p>
<p>To enable set IFileSharingEnabled key to true in Info.plist (note it is not a string)<span id="more-1111"></span></p>
<h4>The file share directory</h4>
<p>When file sharing is enabled, the entire Documents folder is used for  file sharing. Files that that are not intended for user access via the  file sharing feature should be stored in another part of your  application&#8217;s bundle (apps are rejected if files not intended for sharing are stored there).</p>
<h4>Good Resources</h4>
<p><a href="http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app" target="_blank">http://www.raywenderlich.com/1948/how-integrate-itunes-file-sharing-with-your-ios-app</a></p>
<h4>Issues getting UIFileSharingEnabled to work</h4>
<p><a href="http://stackoverflow.com/questions/2603865/cfbundledocumenttypes-uifilesharingenabled-issues" target="_blank">http://stackoverflow.com/questions/2603865/cfbundledocumenttypes-uifilesharingenabled-issues</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/file-transfer/transfering-files-via-itunes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Battery State</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/battery/get-battery-state</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/battery/get-battery-state#comments</comments>
		<pubDate>Fri, 17 Feb 2012 15:43:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Battery]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1108</guid>
		<description><![CDATA[Turn on battery monitoring for your app [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; Getting The Current State //----- DISPLAY BATTERY STATE ----- if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateUnknown) { [BatteryStateLabel setText:@""]; } else { NSString *BatteryString = [NSString stringWithFormat:@"Battery: %0.0f%%", [[UIDevice currentDevice] batteryLevel] * 100]; switch ([[UIDevice currentDevice] batteryState]) { case 1: //Battery is in use (discharging) break; [...]]]></description>
			<content:encoded><![CDATA[<h5>Turn on battery monitoring for your app</h5>
<pre><code>
	[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
</code></pre>
<p><span id="more-1108"></span></p>
<h5>Getting The Current State</h5>
<pre><code>
	//----- DISPLAY BATTERY STATE -----
	if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateUnknown)
	{
		[BatteryStateLabel setText:@""];
	}
	else
	{
		NSString *BatteryString = [NSString stringWithFormat:@"Battery: %0.0f%%", [[UIDevice currentDevice] batteryLevel] * 100];

		switch ([[UIDevice currentDevice] batteryState])
		{
			case 1:
				//Battery is in use (discharging)
				break;

			case 2:
				//Battery is charging
				BatteryString = [BatteryString stringByAppendingString:@" (charging)"];
				break;

			case 3:
				//Battery is fully charged
				BatteryString = [BatteryString stringByAppendingString:@" (charged)"];
				break;

			default:
				//Battery status is unknown
				break;
		}
		[BatteryStateLabel setText:BatteryString];
	}
</code></pre>
<h4>Good Resources</h4>
<p><a href="http://iphonedevelopertips.com/device/display-battery-state-and-level-of-charge.html" target="_blank">http://iphonedevelopertips.com/device/display-battery-state-and-level-of-charge.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/battery/get-battery-state/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System Alerts</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/alert-view/system-alerts</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/alert-view/system-alerts#comments</comments>
		<pubDate>Thu, 16 Feb 2012 17:29:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Alert View (Message Box)]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1099</guid>
		<description><![CDATA[System Alerts Calling Methods System alerts, such as &#8221;Low battery, 20% of battery remaining&#8221; will call the following methods: applicationWillResignActive called before the alert comes up applicationDidBecomeActive called after the alert is dismissed A typical problem is if you use applicationDidBecomeActive to detect your app starting up from a suspended state (from multitasking).  To solve this [...]]]></description>
			<content:encoded><![CDATA[<h4>System Alerts Calling Methods</h4>
<p>System alerts, such as &#8221;Low battery, 20% of battery remaining&#8221; will call the following methods:<span id="more-1099"></span></p>
<p style="padding-left: 30px;">applicationWillResignActive called before the alert comes up</p>
<p style="padding-left: 30px;">applicationDidBecomeActive called after the alert is dismissed</p>
<p>A typical problem is if you use applicationDidBecomeActive to detect your app starting up from a suspended state (from multitasking).  To solve this use applicationWillEnterForeground (which isn&#8217;t called after a system alert), or if you need a &#8216;did&#8217; rather than a &#8216;will&#8217; method then you can use this approach:</p>
<pre><code>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	...
	ThisIsAppStartup = YES;
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
	ThisIsAppStartup = YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
	if (ThisIsAppStartup)		//Don't do if we're just returning from a system alert like low battery
	{
		//We are here after didFinishLaunchingWithOptions and applicationWillEnterForeground
		ThisIsAppStartup = NO;
		...
	}
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/alert-view/system-alerts/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Background Download File From URL</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/tcpip/background-download-file-from-url</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/tcpip/background-download-file-from-url#comments</comments>
		<pubDate>Fri, 06 Jan 2012 14:59:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1091</guid>
		<description><![CDATA[In your .h header file @interface ### { NSMutableData *fileData; NSURLConnection *connectionInProgress; } - (void)DownloadFileFromUrl:(NSString *)fileURL; In Your .m file //******************************************** //******************************************** //********** DOWNLOAD FILE FROM URL ********** //******************************************** //******************************************** - (void)DownloadFileFromUrl:(NSString *)fileURL { NSLog(@"Get file from URL starting"); NSURL *url = [NSURL URLWithString:fileURL]; NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; //Clear any existing connection [...]]]></description>
			<content:encoded><![CDATA[<h5>In your .h header file</h5>
<pre><code>
@interface ###
{
	NSMutableData *fileData;
	NSURLConnection *connectionInProgress;
}

<span id="more-1091"></span>

- (void)DownloadFileFromUrl:(NSString *)fileURL;
</code></pre>
<h5>In Your .m file</h5>
<pre><code>
//********************************************
//********************************************
//********** DOWNLOAD FILE FROM URL **********
//********************************************
//********************************************
- (void)DownloadFileFromUrl:(NSString *)fileURL
{

	NSLog(@"Get file from URL starting");

	NSURL *url = [NSURL URLWithString:fileURL];
	NSURLRequest *request = [NSURLRequest requestWithURL:url
											 cachePolicy:NSURLRequestReloadIgnoringCacheData
										 timeoutInterval:30];

	//Clear any existing connection if there is one
	if (connectionInProgress)
	{
		[connectionInProgress cancel];
		[connectionInProgress release];
	}

	[fileData release];
	fileData = [[NSMutableData alloc] init];

	connectionInProgress = [[NSURLConnection alloc] initWithRequest:request
														   delegate:self
												   startImmediately:YES];
}

//*************************************************
//*************************************************
//********** NEXT BLOCK OF DATA RECEIVED **********
//*************************************************
//*************************************************
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
	[fileData appendData:data];
}

//******************************************
//******************************************
//********** ALL OF DATA RECEIVED **********
//******************************************
//******************************************
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
	NSLog(@"Got file from URL");

	//CONVERT TEXT FILE TO STRING
	//NSString *SourceString = [[[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding] autorelease];
	//NSLog(@"Text file received. Contents = %@", s);

	//DISPLAY AN IMAGE FILE
	//[MyImageView setImage:[UIImage imageWithData:fileData]];

	//RELEASE CONECTION
	if (connectionInProgress)
	{
		[connectionInProgress release];
		connectionInProgress = nil;
	}
}

//***************************************
//***************************************
//********** CONNECTION FAILED **********
//***************************************
//***************************************
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
	[connectionInProgress release];
	connectionInProgress = nil;

	[fileData release];
	fileData = nil;

	NSLog(@"Get file from URL failed");
}
//*****************************
//*****************************
//********** DEALLOC **********
//*****************************
//*****************************
- (void)dealloc
{
	[fileData release];
	[connectionInProgress release];

	[super dealloc];
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/tcpip/background-download-file-from-url/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmatically Fake a Button Touch Event</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/buttons/programmatically-fake-a-button-touch-event</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/buttons/programmatically-fake-a-button-touch-event#comments</comments>
		<pubDate>Thu, 05 Jan 2012 14:40:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Buttons]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1081</guid>
		<description><![CDATA[If you need to fake a touch event and not simply call a UIButtons method, you can use this: [MyButtonName sendActionsForControlEvents: UIControlEventTouchUpInside];]]></description>
			<content:encoded><![CDATA[<p>If you need to fake a touch event and not simply call a UIButtons method, you can use this:</p>
<pre><code>
	[MyButtonName sendActionsForControlEvents: UIControlEventTouchUpInside];
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/buttons/programmatically-fake-a-button-touch-event/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating UI Controls On Background Threads</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/threads/updating-ui-controls-on-background-threads</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/threads/updating-ui-controls-on-background-threads#comments</comments>
		<pubDate>Wed, 04 Jan 2012 18:21:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Threads]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1067</guid>
		<description><![CDATA[It is strongly recommended not to update UI controls etc from a background thread (e.g. a timer, comms etc).  This can be the cause of crashes which are sometimes very hard to identify.  Instead use these to force code to be executed on the UI thread (which is always the &#8220;main&#8221; thread). Dispatch Async And Dispatch Sync [...]]]></description>
			<content:encoded><![CDATA[<p>It is strongly recommended not to update UI controls etc from a background thread (e.g. a timer, comms etc).  This can be the cause of crashes which are sometimes very hard to identify.  Instead use these to force code to be executed on the UI thread (which is always the &#8220;main&#8221; thread).<span id="more-1067"></span></p>
<h4>Dispatch Async And Dispatch Sync</h4>
<pre><code>
	dispatch_async(dispatch_get_main_queue(), ^{
		//Code here to which needs to update the UI in the UI thread goes here

	});
</code></pre>
<p>The dispatch_async() method starts an asynchronous task.  If you want to wait until the method is finished, use dispatch_sync instead (i.e. when you want to execute a block and wait for the results).</p>
<p>Here&#8217;s dispatch_sync with a check to see if its necessary first:</p>
<pre><code>
	if ([NSThread isMainThread])
	{
		[self MyMethodName];
	}
	else
	{
		dispatch_sync(dispatch_get_main_queue(), ^{
			//Update UI in UI thread here
			[self MyMethodName];
		});
	}
</code></pre>
<h4>Useful Method To Avoid Hang If Thread Is Already Main Thread</h4>
<p>This handy method is based on the one here at <a href="http://stackoverflow.com/questions/5662360/gcd-to-perform-task-in-main-thread" target="_blank">stackoverflow</a></p>
<pre><code>
void runOnMainQueueWithoutDeadlocking(void (^block)(void))
{
	if ([NSThread isMainThread])
	{
		block();
	}
	else
	{
		dispatch_sync(dispatch_get_main_queue(), block);
	}
}
</code></pre>
<p>Then you use this in your code</p>
<pre><code>
	runOnMainQueueWithoutDeadlocking(^{
		//Do stuff
	});
</code></pre>
<h4>Perform Selector On Main Thread</h4>
<p>When you&#8217;re using iOS &gt;= 4, you use dispatch_async over this as it the same as like doing waitUntilDone:NO.  If you want to wait until the method is finished use dispatch_sync.</p>
<p>However thi sis how it works to call a method on the main thread</p>
<pre><code>
	[self performSelectorOnMainThread:@selector(MyMethodName) withObject:nil waitUntilDone:NO];</code></pre>
<h4>Is This The Main Thread?</h4>
<pre><code>
	if ([NSThread isMainThread])
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/threads/updating-ui-controls-on-background-threads/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting App Version Number</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/general/getting-app-version-number</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/general/getting-app-version-number#comments</comments>
		<pubDate>Fri, 18 Nov 2011 11:14:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.General]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1063</guid>
		<description><![CDATA[Get Build Version Number [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]]]></description>
			<content:encoded><![CDATA[<h4>Get Build Version Number</h4>
<pre><code>[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/general/getting-app-version-number/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read System Volume Setting</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/audio/read-system-volume-setting</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/audio/read-system-volume-setting#comments</comments>
		<pubDate>Wed, 16 Nov 2011 11:41:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Audio]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1058</guid>
		<description><![CDATA[Reading the current system audio volume MPMusicPlayerController *iPod = [MPMusicPlayerController iPodMusicPlayer]; float volumeLevel = iPod.volume; NSLog(@"Volume: %f", volumeLevel); You need to import the MediaPlayer framework and use: #import &#60;MediaPlayer/MediaPlayer.h&#62; Other resources http://stackoverflow.com/questions/7255006/get-system-volume-ios]]></description>
			<content:encoded><![CDATA[<h4>Reading the current system audio volume</h4>
<pre><code>
		MPMusicPlayerController *iPod = [MPMusicPlayerController iPodMusicPlayer];
		float volumeLevel = iPod.volume;
		NSLog(@"Volume: %f", volumeLevel);
</code></pre>
<p><span id="more-1058"></span></p>
<p>You need to import the MediaPlayer framework and use:</p>
<pre><code>#import &lt;MediaPlayer/MediaPlayer.h&gt; </code></pre>
<h4>Other resources</h4>
<p><a href="http://stackoverflow.com/questions/7255006/get-system-volume-ios" target="_blank"> http://stackoverflow.com/questions/7255006/get-system-volume-ios</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/audio/read-system-volume-setting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C Arrays</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/memory/arrays/c-arrays</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/memory/arrays/c-arrays#comments</comments>
		<pubDate>Tue, 15 Nov 2011 17:23:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Arrays]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1055</guid>
		<description><![CDATA[Using C Arrays UInt8 MyArray[10]; MyArray[0] = 0x00; MyArray[1] = 0x01; int LengthOfMyArray = length:sizeof(MyArray);]]></description>
			<content:encoded><![CDATA[<p>Using C Arrays</p>
<pre><code>
	UInt8 MyArray[10];
	MyArray[0] = 0x00;
	MyArray[1] = 0x01;

	int LengthOfMyArray = length:sizeof(MyArray);
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/memory/arrays/c-arrays/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIView</title>
		<link>http://www.ios-developer.net/iphone-ipad-programmer/development/window-uiviewcontroller-etc/uiview</link>
		<comments>http://www.ios-developer.net/iphone-ipad-programmer/development/window-uiviewcontroller-etc/uiview#comments</comments>
		<pubDate>Fri, 11 Nov 2011 15:14:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Window, UIViewController etc]]></category>

		<guid isPermaLink="false">http://www.ios-developer.net/?p=1041</guid>
		<description><![CDATA[Referencing A View In A .xib In #ViewController.h @interface SomeViewController : UIViewController { UIView *MyView; { @property (nonatomic, retain) IBOutlet UIView *MyView; In #ViewController.m @synthesize MyView, - (void)viewDidUnload { self.MyView = nil; } Moving A UIView CGRect frame = self.MyView.frame; frame.origin.x = 0; self.MyView.frame = frame; Bring A View To Front [self.view bringSubviewToFront:MyView]; Or use [...]]]></description>
			<content:encoded><![CDATA[<h4>Referencing A View In A .xib</h4>
<h5>In #ViewController.h</h5>
<pre><code>
@interface SomeViewController : UIViewController
{
	UIView *MyView;
{
@property (nonatomic, retain) IBOutlet UIView *MyView;
</code></pre>
<p><span id="more-1041"></span></p>
<h5>In #ViewController.m</h5>
<pre><code>
@synthesize MyView, 

- (void)viewDidUnload
{
	self.MyView = nil;
}
</code></pre>
<h4>Moving A UIView</h4>
<pre><code>
	CGRect frame = self.MyView.frame;
	frame.origin.x = 0;
	self.MyView.frame = frame;
</code></pre>
<h4>Bring A View To Front</h4>
<pre><code>
	[self.view bringSubviewToFront:MyView];

Or use this:
	MyView.layer.zPosition = 1;
</code></pre>
<h4>Hiding A View</h4>
<pre><code>
	self.MyView.hidden = YES;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ios-developer.net/iphone-ipad-programmer/development/window-uiviewcontroller-etc/uiview/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

