Author Archives: Claudia Grilli

Interesting article about lighter View Controllers

In a previous post I stressed the importance of creating maintainable code. I’m trying to improve in this field reading and coding with more attention to maintainability. Recently I read a very interesting article about “lighter” View Controllers. The site is new and if a good beginning bodes well… I subscribed to be notified of future articles.

Create a Universally Unique IDentifier

Problem: How to get a unique device identifier (i.e. to implement InApp purchasing) without using UDID, banned by Apple.
Solution: In iOS6 we can use identifierForVendor. In prior versions we will use CFUUIDRef. Note that in this case every call of CFUUIDRef creates a new UUID. It is necessary to save the UUID in the device keychain to make it unique.
Read also: Universally Unique IDentifier in iOS5 by Marek Bell
[objc]
+ (NSString *)createLocalUUID {

NSString *localIdentifier;

if ([[UIDevice currentDevice] respondsToSelector:NSSelectorFromString(@”identifierForVendor”)])
// iOS version >= 6
localIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
else {
// iOS version < 6 CFUUIDRef uuidRef = CFUUIDCreate(NULL); CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef); CFRelease(uuidRef); localIdentifier = [NSString stringWithString:(__bridge NSString *)uuidStringRef]; CFRelease(uuidStringRef); } return localIdentifier; } [/objc]

Small lessons learned

  1. Get some help! I am fortunate to have a smart person next to me who helped me at all stages of the application. I also discovered that the iOS developer community on the net is wonderful! Just do a little research and you will find solutions to any problem or doubt you may have as a newbie like me. This site was created also to try to give something back compared to what I learned on the net and I hope to become useful soon.
  2. Do not underestimate the importance of the design phase of the app. I’m not thinking about graphics only but also to the creative phase in which we imagine the app..Start writing code when it is not clear where are the boundaries of the app, led me to make mistakes paid with the reconstruction of several parts and the consequent displacement of the publication date (app is in the ultimate test phase at the moment). In the future I would like to spend some time learning something more about the design phase.
  3. Once “imagined” and perhaps put the idea on paper I can move on to imagine the “structure” of the app to create maintainable code in the future. A mistake that unfortunately came natural, given the limited idea of ​​the final app and my little experience, was the creation of a gigantic ViewController that used in the slightest degree the opportunities offered by iOS programming. The structure of the app should be thought of making the most of delegates, notifications, and so on to make the code manageable.
  4. Try, read, find new solutions! Sometimes solutions look really good on paper but they aren’t. Before throwing myself headlong I should try and assess other possibilities. In the end we need to learn.
  5. The day does not end when you close Xcode! Podcasts, articles and books are essential.

First of all

Everything started several months ago. I realized that the job I was doing was extremely boring (at least it was for me). It was so boring that I had plenty of time to learn something new. After a brief search on iTunesU (a gold mine!) I found the iOS lessons from the Stanford University (CS193P). It would have been great to have a professor like Paul Hegarty at my university! Amazing!

After some years as a developer and system administrator in Microsoft systems it would have been difficult to change inside the company where I worked. I decided to leave and start again. Since then I have been working full-time as an iOS developer and discovered how different it is to devote my time to something I like to do (at last!)

People who know me look at me with a mixture of admiration (a little) and compassion (a lot): “did you leave a good job to start from scratch?”. But I’m not starting from zero… I’m starting from three!