Tagged: Cheapest Toggle Comment Threads | Keyboard Shortcuts

  • intern 7:09 pm on July 1, 2009 Permalink |
    Tags: Cheapest, decimal separators, , localization   

    On Monday, I spent some time in the morn… 

    On Monday, I spent some time in the morning polishing up the photoshop comps I’d been working on. There’ll be a more detailed full writeup on the process I went through with those once they’re totally finished. In the afternoon I turned my attentions back to the Cheapest app. My mission: to locate and fix a bug that prevented use of numbers after the decimal point when an iPhone’s localization settings dictate a comma instead of a period as the decimal separator.

    There was already some cleverness going on in terms of localization: the following line of code made sure that where appropriate, the comma was used instead of the period:
    decimalChar = field.formatter.decimalSeparator;
    decimalChar is then appended to the current digits in the field. This is all well and good: people get a familiar decimal separator. The problem was that when they moved on to the next field, digits after the decimal were lost.

    What a mystery. I should mention that these are really my first forays into objective-c, so I’m very much learning to read the syntax as I go. After some time spent reading documentation, and hunting through different parts of the program, including an introduction by Steve to the debugging features in x-code, I figured out the process the application went through each time a field lost focus.

    When the user presses a key on the calculator keyboard built into the app, that digit is appended to a string variable (string of text). Only when the field loses focus, is that value mined for its numbers, and passed to a different variable in the local currency format. The problem was, the part of the program that stripped the numbers out of the text didn’t know what to do with a comma, and so digits after the comma were lost.

    The fix was quite simple: change commas to periods, before parsing the string for its numbers. I didn’t need to worry about putting commas back in, because the currency-formatted variable that reads those numbers already knows about localisation.

    So the problem was fixed with a single line of code, incidentally, my very first line of code to go into a published application.

    And here it is:
    title = [title stringByReplacingOccurrencesOfString:@"," withString:@"."];

    Takehome lessons:

    1. doubleValue doesn’t know about commas or localisation
    2. x-code’s documentation feature is my friend
    3. spend time figuring out exactly where your bug is happening in the code
    4. use debugging tools to do this
    5. once you know where it’s all going wrong, the hard part might well be over
     
    • intern 11:33 am on July 9, 2009 Permalink

      Konstantin, if there’s something specific you’re looking for, let me know and I’ll do my best to answer your question.

    • KonstantinMiller 11:45 pm on July 6, 2009 Permalink

      Hi! I like your srticle and I would like very much to read some more information on this issue. Will you post some more?

  • intern 6:46 pm on June 23, 2009 Permalink |
    Tags: audio codecs, Cheapest, , Kerching!   

    iPhone development Tuesdays: Today bega… 

    iPhone development Tuesdays:

    Today began by testing Cheapest, a nifty little calculator app that finds price differences per unit for items sold in bulk at the grocery store. The handy ‘kerching’ noise that indicates successful completion of the calculation did not play under new iPhone OS. time for some bug-hunting.

    I spent some time reading through changes to the audio codecs that run in the new iPhone OS, and thinking about ways to bring those in without destroying backward compatibility. The error that the application was throwing out looked a little bit like this:

    Tue Jun 23 14:31:04 unknown mediaserverd[487] : [14:31:04.568 ] AudioQueue codec policy 1: failed to find a codec of the requested type

    YUCK.

    Then, senior studio developer, Steve, suggested that perhaps this might be a format issue. Good thinking Steve. Three minutes of google searching, and one creative commons licensed new sound effect in a more compatible format later, and my professional iPhone developer testing device (ipod touch) was making happy cash register noises at the touch of a button. Successful afternoon I’d say.

    Next challenge: making the iPhone 2.2.1 simulator run happily to check for backward compatibility.

     
  • intern 6:11 pm on June 22, 2009 Permalink |
    Tags: Cheapest, , Monday   

    Today, after spending some time in the m… 

    Today, after spending some time in the morning tweaking my three photoshop comps, I began work getting an iPhone development environment set up on mine and another laptop. The SDK includes a new version of apple’s development environment, xcode. With this up and running, I used my new-found knowledge of the subversion version tracking system to check out code to my local machine for the first application that I’ll be working on.

    My task is to go through the application, checking for compatibility issues with the new iPhone operating system. The development environment allows me to simulate different iPhone hardware and software combination. Additionally, once I am authorised, I’ll be able to build and install applications on my ipod touch.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel