Jon's Blog


Quick Update

Been a while since I last posted, since then I have released LocationPRO, a paid upgrade of Location+ with great extra features.

Location+ has had 11000 downloads so far and LocationPRO just over 550. 

I recently pushed updates for both Apps that bring compatability with the Retina Display of the new iPad.

I reached the last stage of the recruitment process for Apple but was then turned down at the last minute, it was probably for the best as I am not a web developer and a considerable amount of that role would be spent working with PHP which I would not have enjoyed.

Since then I have been offered an internship at GE (General Electric) and I am looking forward to hearing my exact role and location soon :)

CLGeocoder example


Reverse Geocoding has been achieved using MKReverseGeocoder, however in the latest version of iOS, iOS 5.0 it has been deprecated, this does not mean that you cannot use it but it does mean that its use is not actively encouraged. Chances are that if the application you are building is targetting for devices running pre iOS5 operating systems then it will be approved. However if you are building for iOS 5 and onwards then there is a possiblilty that you're application will not be approved as you are using a deprecated method or so I have heard.  In the meantime Apple recommend you use CLGeocoder instead.

So what is Reverse Geocoding anyway?

Well according to Wikipedia:

Reverse geocoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or areal subdivisions such as neighbourhoods, county, state, or country.

That definition is very accurate, basically in our applications we want to be able to convert the reading provided by the GPS unit usually delivered in the form of latitude and longitude into something that is readable by regular humans, im not saying that longitude and latitude are not useful im just saying that different apps require different results. When I was writing my first iOS application Location+ I wanted to add some Reverse Geocoding functionality, but I was targetting iOS5 and onwards I wasnt going to be able to use MKReverseGeocoder. This was a bit irritating at the start as being a self taught and very much still learning Objective-C/iOS programmer I rely heavily on tutorials posted on the web for both technical and inspirational help and with CLGeocoder being so new and also most people still using MKReverseGeocoder there was not much available to help really. Hopefully this tutorial will add some more content.

So what does it really look like?

iOS Simulator Screen shot 4 Dec 2011 22.07.57

This is a screenshot taken from the simulator in Xcode that shows the basic information that can be retrieved using CLGeocoder and im sure that you can see immediately that it can be very useful to a whole plethora of App developers. Chances are if you are reading this you are probably just learning the language and might well be just creating a location based application where you can feel like you have achieved something very quickly.

What information is made available by CLGeocoder?

Using the CLGeocoder to return a CLPlacemark is the way that I have done it, a CLPlacemark object is bascially just a marker for your current locaton that contains information about where you are, its as simple as that.

Screen Shot 2011-12-05 at 09.56.34

As you can see there is a lot of possible values that you can extract from a placemark but they are named a little vaguely so once you have it working you will have to experiment a little bit to get what you are after.

How do I do it?

Screen Shot 2011-12-05 at 09.59.38

Well its actually suprisingly simple, firstly create yourself a few labels or text boxes and then add them to your header file to have the synthesizing done for you. You can name them with something meaningful e.g. townLabel or something along those lines. Next step is to create a CLGeocoder and LocationManager objects and repeat the same steps, in this case I called mine CLGeocoder. Note you may need to add MapKit and CoreLocation to your project, just add them in the bundled libraries and import the header files <MapKit/MapKit.h> and <CoreLocation/CoreLocation.h> if you have any problems. After that switch to your implementation file (your .m file) then either create a simple -(IBAction) method attached to a button or place this code in the viewDidLoad function. You can comment out the [locationLabel setText] method if you dont have a label and it will just be printed to the console.

  //Geocoding Block

    [self.geoCoder reverseGeocodeLocation: locationManager.location completionHandler

     ^(NSArray *placemarks, NSError *error) {

         

         //Get nearby address

         CLPlacemark *placemark = [placemarks objectAtIndex:0];

         

         //String to hold address

         NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];


         //Print the location to console

         NSLog(@"I am currently at %@",locatedAt);

         

         //Set the label text to current location

         [locationLabel setText:locatedAt];

         

     }];


download


Basically what this peice of code does is enable the LocationManager object so that the phone tracks where you are and then Reverse Geocoder your location based on the LocationManager parameter that you pass it, in this case we have used locationManager.location. Apple say that you should not call Reverse Geocoding methods more than once a minute so the best way for us to do this is just have have the function calls in the viewDidLoad so they will be ready for when the view loads and are only called once each time the view is loaded. To actually get the data you need to call the reverseGeocodeLocation function, this returns an Array of CLPlacemarks, in this case we only need the information once so we will be accessing index 0 of the Array. By accessing Index 0 we create a placemark object that can easily be assigned to a text field by calling               yourtextbox.text = placemark.whatever; its really as easy as that.

This may be a bit vague but everything that you need is here to help allow you to use the CLGeocoder in your applications and perhaps it will be of help to a few people.

Good Luck!


2000+ downloads and an update


Location+ has had over 2000 downloads thus far, this is really way more than I ever thought possible! 

Version 1.2 has been submitted to Apple for review, this main features of this update are reverse geocoding and twitter integration.

Find it here

Here are some screenshots of Location+ 1.2



Multitouch Gestures in XCode Simulator

Learned something today in a lecture that I had no clue existed in XCode, the lecture was on Android development and the lecturer said that the Android simulator did not have multitouch and apparently XCode did, ive seen some markers on the simulator on videos on youtube but just thought it was an old version of XCode.

Anyway if you hold down ALT/Option on a Mac keyboard you gain access to multitouch gestures in Xcode.

Happy Days :)


863 Downloads in 3 and a bit days

Screen Shot 2011-11-27 at 11.11.55


Location+ still doing a lot better than I ever expected, 863 downloads so far hoping to 1000 when the figures are release on iTunes Connect later this afternoon. I have submitted and resubmitted an update to Location+ 3 times as I have kept fiddling with it, the current version really looks a bit boring compared to the newer version that I hope will be approved by the end of the week latest. 

The new version has had quite a few tweaks, UI Tweaks, no longer shake to show more just press the button that looks like a bar chart, then a speed view and the ability to drop pins on the map, the pin will show the latitude and longitude of wherever you dropped it so you can compare it your current location or also find latitude and longitude to put into your satnav. Over Christmas the next updates are going to be creating a custom bubble for when you hit the pin and show the reverse geocoded data for the address and postcode of wherever you drop the pin. The easiest way of doing this has been deprecated in iO5, its MKReverseGeocoder, I had a test of it last night and it does work but its a lot of work to get the Custom Callouts working and I dont want to use a deprecated method as I will probably get the App rejected by Apple if it is used.

Some images of the update, Location+ v1.1 should be available on the App Store by the end of the week if Apple have no problems with it.

iOS Simulator Screen shot 27 Nov 2011 11.20.50



Showing Hidden Files on Mac

For anyone that comes from the Windows world you will most likely know the procedure of Showing Hidden Files and Folders by going through various GUI windows that seems to change in every new version of Windows.

As far as I can see there is no way of doing this through the GUI on the Mac so I thought I would share how its done.

Just copy this into the terminal

defaults write com.apple.finder AppleShowAllFiles TRUE

Then if you want turn them back off again, you will need to restart finder first just hold down alt and right click on the finder icon in the dock. After that its all done

Screen Shot 2011-11-27 at 11.09.33


To stop showing hidden files and folders just type in the same thing by change the TRUE to FALSE

defaults write com.apple.finder AppleShowAllFiles FALSE



385 downloads and an update for Location+

Got the latest download figures in today, 385 for the first 24 hours! Was expecting 40 maximum!!! Also Location+ has reached 21st in the iPad Navigation free category of the App Store!

Just finnished submitting an update for Location+ for the iPhone version that adds a few more options including a SpeedView, more on that to come later.

The new main screen is below.

IMG 0047
iOS Simulator Screen shot 24 Nov 2011 22.15.14
IMG 0053



44 Downloads in 10 hours

Location+ has had a lot more downloads that I thought it would already!!

Screen Shot 2011-11-23 at 18.12.28

Happy Days! Glad to have written something that people are actually interested in, Christmas will be the next upgrade I think, so impressed with the power and appeal of the App Store so far!!


Location+ now available on the app store!


               

                                                                    Click to download Location+

iphone


I submitted Location+ to the App Store last Friday night, I woke up this morning to 3 emails telling me that it was now ready for sale! I had no expectation that it would pass first time or even that it would be something that they would consider 'worthy'.


Screen Shot 2011-11-23 at 15.26.07


The application seemed to have spend 36 minutes 'In Review' and judging by the timing of the emails they are reviewed onsite in America, Location+ is only around 1000 lines of code so if this really does explain why there such delays to Apple's review period. 

Screen Shot 2011-11-23 at 15.29.10

Im very happy that it has been released to the public as it is something that I hope can be moulded into a useful application with future updates, I think Christmas will be the next time I get to spend time starting updates as I have 3 assignments to be getting on with so far. If you are able to suggest improvements or just give me some general feedback then please fill in the form here. To anyone that wants to start iOS development I would highly recommend learning an OO (Object Oriented) language like Java first as there really is a big step up to Objective-C, having done a bit of Visual Basic or PERL is not going to put you in a good position to start. You can start developing for free just download XCode from the Mac App Store, you only need to join the Apple Developer Program if you wish to run applications on your own device rather than the simulator or actually submit your application to the App Store. Youtube tutorials are a great source of help and also if you are serious about starting development I would recommend iPhone and iPod Touch Essential Training and iOS 4 App Development New Features by Lynda.com they are really really good tutorials created by professionals.



Domains and Adsense

I have been testing Adsense on this website, really just to see how much it has improved since when I last used in 2004 where it really was just an eye swore, so far it seems much improved, some of the adds are really quite relevant and eye catching. I dont think it will ever generate any return for me but ah well.

I feel that jonathanfield.me is really quite generic and boring, im putting in serious consideration to purchasing http://www.strengthindepth.co.uk , I really like the phrase and seems like it has more of an identity than my name followed by a tacky .me extension. GoDaddy keep sending out 30% coupons so I might think about doing that tomorrow.




© Jonathan Field 2011