Categories
iPhone app Software development

Update sqlite database during iOS app update

Reading Time: 2 minutes

We all know updating sqlite database on an existing iOS app could be tricky, esp. with any schema (table) changes. In the good old days when I was developing in-house app, I found out the app would crash when I added a column to the sqlite database, after merely updating the app. The problem was, the old database won’t get updated if we don’t explicitly do it during app start-up (after app update). So what did I tell my user to do? Delete the app, and re-install the app. Not the most user-friendly way, and what if the user has some data on it that he/she wants to keep? What if this app have many users?

I had this updating issue in my mind for a while, because one of my apps needs to refresh its data. There are a few ways to do it: 1) Use a web service to get the data; 2) Just update the sqlite database. The former has some limitations: we could get data via web service, but note we still need to manipulate the database if we need to add a column or table (this is same for both approaches). The latter is faster in terms of development. So I decided to do it. I did some research on stackoverflow and found this post as my reference. Here is my implementation, if you are interested. The following is done in viewDidLoad.

Categories
iPhone app

Developer EQ series : 1

Reading Time: < 1 minute

Dont’s
Beat up people in code review or interview;

Change other developers’ code without proper communication, or reasoning; worse, making the working code no longer work (sometimes to satisfying the “tests” 🙂

Do’s
Learn, learn something everyday;

Acknowledge our own limitations: acknowledge our mistakes if applicable, we all do make mistakes;

In the same token, when we learn something from someone else, show our appreciation;

PS, also came across this piece “assertiveness from developers” by Jeff Atwood (@codinghorror), which I think is excellent. Essentially the point there is be a good developer is not to be a “nice person to everyone”. A good developer uses his/her best judgement, and speaks from his/her own mind, which includes saying something make other stakeholder uncomfortable (as long as it’s fair and honest statement).

And, slightly off topic, this one “Your Company Is Not A Family” from HBR (Harvard Business Review).

Categories
iPhone app

Working on new app DiscoverSTL

Reading Time: < 1 minute

Alton_Missisispi_River_512x512

Categories
iPhone app

Swift might the the language of the future

Reading Time: < 1 minute

Apple : the Swift language (unveiled in WWDC on June 2, 2014)

Tutorials
Developing iOS Apps Using Swift Tutorial Part 1 (Jameson Quave)

learnswift.tips

References and reviews
Matt Galloway : Swift Language Highlights: An Objective-C Developer’s Perspective (raywenderlich.com)

The Verge : The Swift effect: Apple’s new programming language means way more iPhone developers and apps

Ray Wenderlich: Swift Cheat Sheet and Quick Reference (raywenderlich.com)

arstechnica.com : A fast look at Swift, Apple’s new programming language

Btw, Jeff Lamarche (twitter: @jeff_lamarche), the author of Beginning iPhone/iOS Development book, already got book offers for the Swift language. At the same time, don’t throw away Objective-C yet (HuffintonPost).

photo-3

Categories
iPhone app

Some tips for submit app to iTunes App store

Reading Time: 2 minutes

Avoid the Payload validation error
To shorten the review waiting time. I noticed this recently in my own apps update. The one without warning has much shorter review waiting time. The rationale is App thinks the app may use private API in this scenario (see this explanation on stackoverflow). From personal experience the one with warnings could be in the “wait for review” queue at least one week longer than the one without warning. So clean up the code if we can. Btw, I was able to fix the first one below (it turns out to be a third party function I no longer use). For the second one below, I read it could be related to Facebook SDK (which my app uses), but have NOT been able to solve it for now.

collegeFund_submit_warnings

ToMarket_submit_upload_warn

Validation
Validate before submit to App store, in Xcode organizer.

Keywords
Try put in relevant key words for the app during update (the only time we can change it); we can find some useful keyword by search App store. Also keep in mind search does not work all the time on iPhone.

Code Signing
This one is very subtle. I had two certificates, one was used both for dev and distribution; another one was for distribution (Ad hoc or App store). I found initially I could not sign the app by using the distribution certificate (provisioning profile) alone. After back and forth I was able to sign. And as I look at the certificate in Xcode now, it’s refers to the Ad hoc certificate, but in the submission process it still prompts the first one.

    Categories
    iPhone app

    Ads or no ads

    Reading Time: 2 minutes

    Should I put iAd to my iOS apps on iTunes App store? Should I put the google adsense back to my blog? The reason I am asking this question is: while personally I really don’t like the ads on Facebook, LinkedIn, or the iAds on some apps like Echofon, I understand this is a meaningful way for app developers to make some money. This applies to me as well. While I did not spend whole a lot time working on my apps (in aggregate), I cannot go on this app dev road without any meaningful downloads/income revenue forever. I can do it for a while. But not for too long. I believe Ray Wenderlich talked about the importance of Ad revenue at recent raywenderlich.com podcast. One of the episode of Paul Kemp’s the App Guy Podcast (onemob.com) , talked about something similar.

    I guess, the trick is to balance the ads and app. We don’t want ads to totally destroy the good experience of an app, but at the same time, if the app revenue could help the developer keep going, go for it. We live in a commercial world, no money, no bread. No bread, how can app developers survive?

    photo

    Btw, I found the Apple developer documentation for iAd is insufficient or not up-to-date. For example, it uses requiredContentSizeIdentifiers in the tutorial, which is already deprecated in iOS 6. I found it won’t compile with iOS 7 SDK. I have seen in the past Apple does not always updates its developer documentation. Maybe they have not given high priority to this. I am sure if they pay attention, they can fix it.

      Categories
      iPhone app Software development

      What types of developer are you?

      Reading Time: 3 minutes

      Or am I? 🙂 I think I’m a pragmatic programmer. Note this is also a book title I read, by pragmatic (note not agile), I think it’s about balance between software quality, effort and delivery date. It’s also about releasing software with known risks (including bugs) 🙁

      Pragmatic_Programmer

      I thought about this as I started practicing some new (new to me) programming techniques, e.g., pair programming, test driven development (TDD), and also seen developers of different personalities/experience adjusting to this, at the same time trying to deliver the project on schedule. I felt and considered myself to be lucky in this aspect, as I thought my career at UGS/Siemens PLM Software laid the foundation for me as developer, in other words, I was very lucky to work with some excellent developers (definitely top 20% according to Jeff Atwood, co-founder of stack overflow), and received their guidance and mentoring in my programming formative years. Note I was not doing Agile, TDD, pair programming at that time, at least not formally. But at the latter part of my stay there, I did quite a bit automated unit/regression tests there. Also, although there is no pair programming, whenever I feel stuck, I could go to a senior member of the team, and talk. Not to mention the long debug session. I wrote about them in my blog long time ago (in Chinese, such as this one and this one).

      Categories
      iPhone app

      Three good iOS Mac focused podcast

      Reading Time: 2 minutes

      I have listened to Paul Kemp’s the App Guy Podcast (TAGP) recently, got to know this from @raywenderlich via twitter. Paul’s podcast is not purely technical, it’s more about entrepreneurship, and start own business. It’s an interview format. Paul usually asks indie developers (iOS, web, etc.) questions on how they get started, any pain points or difficulties to strike out on own, vs. getting steady paycheck from corp. Paul himself is an indie developer/podcast too. I think Paul is a good interviewer because he asks good questions, which reminds me of other good/great interviewer such as Charlie Rose (PBS/CBS), and Wealthtrack’s Consuelo Mack (formerly PBS). Again this is not only about blocks, MVC, Xcode, but more about going indie (independent developer).

      Another good podcast, which started recently, is raywenderlich’s. There we have Ray plus 4 developers (Tammy, Jake, Felipe, and Mic). It’s more technical, but it also covers going indie. For that matter, the 4 podcasters have been going indie for some time, and Ray himself was an independent developer before the tutorial site/book took off. So they have a lot to share. And we (as techies) got to listen all the nitty gritty of NSNotifications, design patterns as well, which is cool.

      Categories
      iPhone app

      How to make iPhone app iPhone 5 5s compatible

      Reading Time: 2 minutes

      (Update 03-05-2019, almost 5 years since original post) I did something similar for iPhone X, XR, XS screen size. Basically I stretched the Default-568h@2x.png to Default-375w-812h@3x.png and added that in the “launch image”. I also noticed the some of the nib files have the wrong constraints for label, textfield and button. I made some simple changes so that the top and bottom portions stick. Last but not least, the constraints and the size of google admob banner ads needed similar work: I did the needful and checked those changes worked both for iPhone SE and iPhone X.

      I don’t have iPhone X (XR or XS). My first impression they are much longer than the SE I have.

      (Original 04-13-2014) I found some iPhone apps are still not updated to take advantage the iPhone 5 screen size (4 inch vs. iPhone 4/4s 3.5 inch). I think in many cases the owner of the apps may not have time or the developers don’t know how to stretch the screen. This is a quite common problem. The solution is also fairly straightforward. We only need the stretched version of the screenshot, and name it as Default-568h@2x.png (exactly like this). But to get this all started, you might want to use this blank png file, something like this:

      Default-568h@2x

      Add this file to the Xcode project, and run the simulator. Screen capture the first screen and edit it to make sure it’s 640×1136, and name it as the file name above. This way the app will both have a good launch screen and stretched screen for iPhone 5/5s

      (Update 04-20-14) I found something more interesting. When I tried to add auto layout for the nib (xib) file created in Xcode 3.x, it basically give me a blanket (black) screen. So basically we can not reuse those old nibs for auto layout.

      Categories
      advice and tips finance iOS iPhone app

      Small changes coming to collegeFund app

      Reading Time: < 1 minute

      I was listening/reading two stories on the college debt (source: NPR) and the financial well beings of millennials (source: fortune/cnn), which lead to to add some new features to the collegeFund app. The app was essentially a college savings (529 plan) and I did not thought too much of this college debt problem at the time the app was conceived 3.5 years ago. At the time I opened 529 plan for my daughter, and started put some money into it.

      A lot has changed in my personal finance and to the economy in general. Now I felt for a lot of people, college debt is like a mortgage, it’s just something they have to bear with, and manage while go on with their lives. Btw, I saw another good resource for college debt here.

      I just updated the app, submitted to the app store, it’s under review now. Here is the screenshot. Let me know if you have any questions. Email me at minjie dot xu AT gmail dot com.

      collegeFund_iPhone5_screen

      (Update 05-10-2014) I made couple more updates to fix bugs I introduced when adding this “debt free” tab/screen. It’s mostly settled now. I am thinking other enhancements, along with myNestEgg app.