Category Archives: IOS Development

View Debugging in Xcode 6 causes Mac to crash

I feel like I always start new posts now with.. I’ve been busy… It’s been a while since I’ve posted.. I’ve had a lot on… etc and this post is no different. I’ve been working on a bunch of projects lately both sound and programming related that have been keeping me very busy.
Although it is probably quite specific issue I thought I would post this just incase anyone else was having the same troubles. I’ve started using Xcode 6 and was very excited about using the view debugging tools that let you view your view hierarchy of your app in 3d to inspect your view elements. This is great if your loading some or all of your view programmatically and using the layoutSubviews in your view classes and things are working the way that you expected.

The problem for me was that when ever I tried to use this feature my Mac would freeze for a second and then reboot which was a little frustrating. Turns out this was a fault with the geforce 330M graphics card in mid 2010 Mac pros. Since it’s now 2014 and Apple will only replace this 3 years after the issue was discovered I don’t think I’ll be able to it fixed. Luckily found a little app called gfxCardStatus while allows you to lock your system to using the integrated GPU. After doing this BAM it worked perfectly!

You can download gfxCardStatus here: http://gfx.io/

 

Little Learners iPad and iPhone apps

Icon-72@2x
I’ve just released updated versions of my little learners iOS apps and realised that I hadn’t posted anything when I first released them. These were a pretty massive job for me as not only did I design and code the apps but recorded, edited and voiced all the audio as well.
The apps help children to learn to read using phonics. Children can have the books read to them with the words highlighted as they are spoken and can also touch the individual words and have the audio played to them.
Firstly I had to create a python script to convert all the landscape PDFs into single page png files. I created a separate iPad app which allowed me to create plist files that contained the x, y, width and height of all the words on the PNG images. I then use pro tools to edit and bounce out all the audio files and entered the start time of each word into the plist file as well.
I started working on the main app using a combination of storyboards and programmatically created views and view controllers.
The main app was also created as a static library so that all five apps use exactly the same code base and read all the data from plist files.
I’ll post some code examples in the next couple of weeks but if you would like any more information please feel free to leave a comment.
You can view more info about the app here:
Little Learners

Some Objective-C Handy Additions in iOS6

Here are a few small objective-c language additions that were added in iOS6 that I have found myself using a lot recently  and thought I would share them.

You can create a NSNumber easily now with the below line:

NSNumber *number = @3;

You can create a populated array using the below code.

NSArray *fruit = @[@”Apple”,@”Banana”,@”Orange”];

You can create a populated dictionary easily using this line:

NSDictionary *cats = @{ @”Fred” : @”Large”, @”Dave” : @”Small”};

 

 

Aussie Lingo Audio Companion Update 1.2

Well things have been pretty hectic the last couple of months but I’ve finally managed to get around to updating my Aussie Slang iPhone and iPad app, Aussie Lingo Audio Companion, to work with the iPhone 5 and iOS 6. It also contains 16 more Audio Examples and I also fixed a few small bugs.

Ausse Lingo Audio Companion

I’ll also be updating the free version, Aussie Audio Slang, in the next couple of weeks as well.

You can download the app from the iTunes store by clicking the icon above or clicking here:

shouldPerformSegueWithIdentifier and prepareForSegue in iOS 6

The prepareForSegue method is called just before a segue is performed and allows you to pass variables to the new view controller that is the segue’s destination.

While the prepareForSegue for segue call hasn’t changed between iOS 5 and iOS 6 there has been a new method, shouldPerformSegueWithIdentifier, that has been introduced in iOS 6 which allows you to specify if you want the segue to be be performed or not.. It’s very useful especially for things like only displaying one popover at a time
I’ve included an example of how to to use it below:

-(void) prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"Next View"]) {
      
        //The segue is to the a View Controller called NextViewController
        (NextViewController *nvc =  (NextViewController  *) segue.destinationViewController;
       
       //Set properties in the view controller - note the views outlets are not set yet
        nvc.stringProperty1 = @"This Is Property 1";
      
         nvc.property2 = @"This Is Property 2";
       //Set self as the delegate
       nvc.delegate = self;
    }
}

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
    

    
        if ([identifier isEqualToString:@"Crazy View" ]) {
           
            return NO;
      }


        return YES;
        
    }
        
        
       
}



Aussie Slang with Audio for iPhone and iPad Released

I hope everyone had a fantastic new years and great start to 2013. I think this year is going to be an exciting one!
I’ve just got back from a fantastic holiday in the UK visiting family and having only arrived back in Melbourne this morning am trying to get my brain back into the right timezone. Jet lag sucks!
Anyway onto another topic I’ve just released a free version of my iPhone and iPad app which contains a slightly updated interface and 60 free audio examples with the option to buy more from within the app.
This was my first delve into in-app purchases for iOS and there were few little quirks but after a couple of weeks of on and off coding I’ve launched Aussie Slang with Audio in the iTunes store today.

Icon 144

Here is the info:

Aussie Slang with Audio is a free iPad and iPhone app that contains professionally recorded and produced audio examples of Aussie slang and phrases and is the best way to learn (and laugh at) the language used day to day by us Aussies!

Features:

– Audio recordings of every phrase and bit of slang that show you how us Aussie use Aussie slang in conversation

– Authentic (but funny) Australian Sayings and Slang

– Professionally recorded voice overs with sound effects and atmospheres

– Built for iPhone and iPad and optimised for the iPhone 5

– Created in Australia by Aussies

This is the lite version of Aussie Lingo Audio Companion and comes with 60 free examples. You can unlock more by using the “Get More” button. This also unlocks the suggest button so you can submit slang directly via the app.

Click the image below to open the app the iTunes!

available-on-iphone-app-store-logo1

Any comments/ideas welcome!

Instantiate a View Controller from a Storyboard in IOS

In a lot of the iOS example projects that Apple provides, such as the scrollview paging example, view controllers are Instantiated from an xib file and not from a storyboard which was introduced in iOS 5.
Instantiating a view controller with a story board is quiet easy you just have to specify the name of the storyboard, ie MainStoryBoard_iPhone without the .storyboard and make sure that you have set the identifier of the view controller that you want to instantiate.
Below is a short example:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

MonkeyViewController mkvc = [storyboard instantiateViewControllerWithIdentifier:@"monkeyView"];

you can then add the view to a scrollView using something like:
[self.scrollView addSubview:mkvc.view];

Aussie Lingo Audio Companion – (Australian Slang Dictionary with Audio)

I am about to release a new version of Aussie Lingo Audio Companion – (Australian Slang Dictionary with Audio) in the next couple of days. This update will slightly update the iPhone interface to make it more user friendly, add a suggest button to be able to suggest new lingo straight from the main screen of the iPad and iPhone version, update with 15 or so new bits of lingo and add a button which will open the new Facebook page….

Which brings me to the great segue of…. the new face book page!
https://www.facebook.com/AussieLingoAudioCompanion

If your wandering around Facebook and need something to “like” it’s just sitting there… waiting…

Thanks to everyone who has already liked it. Once again if you want to check out the details or some audio samples head to or use the menu above!

How to create an NSDictionary from a plist file

In a new iPhone app I am currently developing I needed to be able to import the data from a plist file (apple’s XML formatted file) stored within the app bundle and display it in my app. Luckily there is a very handy class method in the NSDictionary class which enables you to create a Dictionary (basically an array with key values) from a file.
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:file];

As I wanted to be able to iterate through all the values in the plist, I created a main dictionary named “database” then within that an array which stored another dictionary that holds my key based data.

This is the code I used to open the plist file and iterate though all the values it contains:

NSString *file = [[NSBundle mainBundle] pathForResource:@"list_of_dogs" ofType:@"plist"];
        NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:file];
        
        NSArray *dogArray = [[NSArray alloc] initWithArray:[dict objectForKey:@"database"]];
        
        
        for (NSDictionary *sectionDict in dogArray){
          
            //loop through the data from the plist
            
            
           NSLog(@"Dog Name = %@ ",[sectionDict objectForKey:@"dog_name"]);   
           NSLog(@"Dog Type = %@ ",[sectionDict objectForKey:@"dog_type"]);  


         
            
            
        }

This is the XML format of the plist file I created:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>database</key>
	<array>
		<dict>
			<key>dog_name</key>
			<string>Jasper</string>
			<key>dog_type</key>
			<string>Great Dane</string>
			
		</dict>
		<dict>
			<key>dog_name</key>
			<string>Samd</string>
			<key>dog_type</key>
			<string>Jack Russell</string>
			
		</dict>
	</array>
</dict>
</plist>

Any questions? hit me up in the comments

Audio Conform Calculator iPhone app now free

In celebration of my new Australian Slang app “Aussie Lingo Audio Companion” I have decided to offer my other app Audio Conform Calculator as a free download from the iTunes app store.

Audio Conform Calculator is a simple iPhone App for sound engineers in which you can specify the source and destination frame rates of the video you are conforming and it will provide you with the percentage and ratio value that the corresponding audio needs to be time expanded or compressed to keep it in sync with the video.

When converting/conforming between video between different frame rates such as FILM, which is 24 frames per second, to PAL, which is 25 frames per second, audio needs to be conformed so that it maintains its sync with the video.

You can download it using the link below:

http://itunes.apple.com/au/app/audio-conform-calculator/id517492265?mt=8