iOS indie developers writing every day about their stuff.

NSTimer and Blocks (Closures)

Tod Cunningham
fivelakesstudio.com

IntroductionI’m always a bit surprised to discover that NSTimer doesn’t have support, out of the box, for blocks or closures.  So I decided to put together this simple extension to NSTimer that supports swift closures.The NSTimer Classic WayNSTimer has been around for a long time.  It uses the objective-c runtime to invoke some code after a period of time. The invocation can be done by either an objective-c NSInvocation object or via selectors.  Let’s look at a simple example of invoking a selector in swift using a NSTimer.class SimpleTimerTest{    var timer : NSTimer?        func someTask( timeout:NSTimeInterval )  […]

Swift Optionals Questions (?) and Bangs (!)

Tod Cunningham
fivelakesstudio.com

I haven’t posted in awhile, but with the Swift 2.0 release, I figured it was time to dip my toe back into the swift waters.  I wanted to share my notes and commentary on optionals.Optional TypesOptional types provide a way to indicate that a value may be nil as opposed to having a value of some given type.  An optional is represented in swift via a simple template enum:enum Optional<T> : NilLiteralConvertible {          case None          case Some(T)        …}    So you can declare and use an optional variable like any other enum:var temperature : Optional<Float> = […]

Advanced Swift – Part 1

Tod Cunningham
fivelakesstudio.com

This is a summary of the topics and notes that I found interesting from watching the Advanced Swift WWDC session 404 by John McCall and Dave Abrahams.  I highly recommend you watch the session.  It also has some commentary from me which you may or may not agree with.  Please feel free to join the conversation. :)I have also attached a swift playground file with the sample code.The Simple Thing ClassThe first class the session introduced was the “Thing” class.  It’s fairly basic, so I went ahead and completed its implementation. This was also the first time I realized that […]

Newsletter

Tod Cunningham
fivelakesstudio.com

We have had more then 700,000 downloads of our apps since 2010, and we don’t have any way to contact those people or know who they are outside of our apps.  For in-app engagement I highly recommend the Apps Fire Booster SDK which I did a blog post about awhile ago.  However, I think we need to be doing more to stay in touch with our users.  I talked with Jody Burgess who runs a strategic marketing company and she planted a bug in my ear about collecting e-mail addresses. Newsletter SignupI decided that collecting e-mail addresses would be a good idea, but I wanted to […]

iOS In-App Purchases

Tod Cunningham
fivelakesstudio.com

This is hopefully a concise getting started with in-app purchases article. Five Lakes Studio has had a fair amount of success with leveraging in-app purchases, and I wanted to share some of the lessons we have learned along the way and also share some code to help make basic in-app purchases a little easier.  This article focuses on non-consumable purchases with built-in product (app) delivery.Setting Up Your AccountIn order to use in-app purchases you have to complete several steps.  A good guide to how to do this is  TN2259 Adding In-App Purchase to your iOS and Mac Applications.   I would recommend taking […]

Cocoa Debugging Tip

Tod Cunningham
fivelakesstudio.com

I’m attending my local Ann Arbor CocoaHeads meeting tomorrow, and the topic isObjective Tips.  So I thought I would share a tip.What do you do when you get a crash due to an uncaught exception such as:2013-03-13 13:30:10.186 Picross[43233:1303] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[AppDelegate crash]: unrecognized selector sent to instance 0xc04de10’*** First throw call stack:(0x355b012 0x32ffe7e 0x35e64bd 0x354abbc 0x354a94e 0x3313663 0x12f54 0x3f0153f 0x3f13014 0x3f042e8 0x3f04450 0x926b5e12 0x9269dcca)libc++abi.dylib: terminate called throwing an exceptionThis can get really frustrating as you need to figure out where in your code it crashed.  Debugger to the rescue.  In the call stack, […]

GameCenter Turn Based Matches

Tod Cunningham
fivelakesstudio.com

We have been looking and doing a major overall to Euchre HD.  In particular, we are looking atleveraging GameCenter’s turn based games.  Right now we use basic Game Center matchs, but there lots of good benefits with being able to leverage the turn based capabilities.  The two big benefits we want are:Support for “live” and “non-live” matches (turn based)Support for TimeoutsImproved Game Center match UIA really good example to get started with Game Center Turn Based match’s is Beginning Turn-Based Gaming with iOS 5 by Jacob Gundersen.  Some API’s have been changed in iOS 6, but it is still a really good […]

Japanese App Store Withholding

Tod Cunningham
fivelakesstudio.com

I learned an interesting lesson this weekend.  I was reviewing our AppStore financial results and I noticed an interesting entry:After a little bit of research, I learned Apple withholds a 20% tax on Japanese sales.  In order to eliminate this tax, you need to file some tax forms with the Japanese government and US government.   Apple helps with this process by providing and submitting the forms.David Smith has a nice article on “Understanding Japanese App Store Withholding” that goes into more detail.I filled out the forms this weekend (8/26/2012), and I will report back on when it takes effect.  I would love […]

Subversion to Git

Tod Cunningham
fivelakesstudio.com

A couple weeks ago Ken and I decided to make the plunge from Subversion to Git.  The main catalyst for this was some Hype generated files I wanted to check into Subversion.  Unfortunately, every time you generate the HTML for a Hype project it blows away the folder structure, which removes the .svn folder and gets subversion all confused.  I understand there are newer versions of Subversion that resolve that issue, but I decided to just do the switchover to Git given that’s where it seems most people are going today.Picking a Hosting ProviderGiven Ken and I work together on […]

Hype – How To Play

Tod Cunningham
fivelakesstudio.com

Ken and I have been struggling with the problem of how to teach people to play our games.  Most of our games are fairly niche, and we would like to broaden their appeal to people who might not know how to play.We wanted something that would accomplish the following goals:Quickly teach the players the basics of game playLook integrated into the appNo download or streamed contentMeasurableWe don’t want to inflate the App size too muchSomething we can create without too much custom programmingWhat we ended up with was a how to play integrated tutorial that was implemented with an imbedded WebView that plays […]