Ad

Our DNA is written in Swift
Jump

This Certificate Has Expired

Has it been 6 months already?

My development and distribution certificates expired much to my surprise while I was sitting on the train. Well actually it had expired the previous night, but it only transpired to me the first time I wanted to Build&Go while en route to Vienna. Which mildly annoyed me at first, but then I found that I can backdate my computers clock two days and restart XCode to allow for temporary continuation of some on-device testing.
Certificate has expired

To renew my certificates I logged into the program portal which already knew that I “currently do not have a valid certificate”. I used the keychain’s certificate assistant to generate the requests saved to disk and submitted them to apple for countersigning.

One thing that confused me was that now the name of the development certificate contains some additional string. I thought that maybe that was appended because I did not remove the expired certificates first, but even when I redid the whole process I did not get rid of it. Another surprise courtesy of Apple.

Read more

The Death of Global Variables

c0der asks:

I currently implement global variables by defining them within the AppDelegate.h file (outside of class definition) and then include this file in each ViewController.m that needs access to these variables.

This works just fine but I’ve noticed that after saving/restoring these variables as persistent data (NSUserDefaults), their values seem to change over time.

My question: is this approach the right way to handle globals without encapsulation? I use a lot of ‘C’ data types — int, char, etc. for my global variables (rather than NSInterger, etc.) so I’m not sure if there’s a better approach.

My short answer: DON’T. Globals are EEEEVILLLLLL. Why not create an engine class for your app that you use as shared instance. Define all your “globals” there.

Read more

Should I Release Outlets?

bqbqhaha asks:

Let me ask you something as below.

  1. A variable declared as IBOutlet could be released?
  2. A variable declared as IBOutlet should be released?

I search for this issue many times, but still the answer is not found.
plz help me , plz

He is asking a question that most of us have when beginning with Interface Builder and Outlets. In plain English his question is “Should I release instance variables declared as IBOutlet?”

Read more

Wife Widowed, Kids Orphaned 'cause Daddy's got a Mac

(Note from editor: When Dr. Touch is not coding or in surgery he preaches the Mac gospel and sometimes somebody hears the calling and switches. This article illustrates this, the title where his own words on twitter.)

Jayman888Thanks to Dr Touch for the opportunity to make a contribution to his blog. I’m a new MacBook user and have had my gorgeous new white MacBook for 48 whole hours. I’m writing this with it sat on my lap. I’ve decided to give it a name ‘Polo’. I don’t know if the meaning will translate into other countries, but in the UK a polo is a small, white mint and is cool.

I’ve been a PC Windows user all my life; I’m 38 now and started using computers on a regular daily basis in the early to mid 90’s. One of the main reasons for the switch is the slow ‘Applefication’ of my life. It started as I replaced an MP3 player with an iPod shuffle, and then an iPod Classic and then I replaced my mobile with an iPhone.

Read more

MyAppSales 1.0.4

I woke up early and was looking for something useful to do with this extra time that would not take too much brain power. This minor update to MyAppSales addresses a pressing issue and some internal cosmetics.

  • Before this fix the local timezone would be used when interpreting a report date. This could lead to unexpected behavior when travelling and synching reports in an earlier timezone. Now all report dates are interpreted as from timezone “America/Los_Angeles”, which is the timezone of Apple in Cupertino.
  • Cleaned up code of iTunes Connector class as a result of making the exchange rate class a shared instance, ordered the functions therein in a more logical way and added section titles for clarification.
  • Now for finding out if a report already was downloaded only the date and type is used. Before this change also time was used but this would change with different local timezones causing duplicate entries.

Refresh your copy from the customer-only SVN to get this update.

UPDATE: WAIT with updating if you have previously existing entries!!! You will get duplicate entries.  (see third fix above. Let me know if you need help cleaning up duplicate entries from your database)

Don't mention SDK/OS 3.0!

If you have any kind of updates that you are publishing right now, please don’t make the mistake of mentioning something like “made compatible with OS 3.0”. A developer friend of mine had his application update rejected because of this.

If Apple Reviewers see such a statement you will get rejected with a lengthy reply stating that the next version is confidential and you are in breach of paragraph §2.1 SDK Agreement.

“…Apple may provide You with pre-release versions of the SDK that constitute Apple Confidential Information and are subject to the confidentiality obligations of this Agreement.”

It will save you a week if you don’t do the above.

Minutes after I posted this heads-up on a forum I was seconded:

I can confirm this too. Got all our apps caught in this trap.
Don’t mention 3.0. anywhere! =P

So in summary you have to make sure that your apps run on a OS 3.0 device, but you cannot mention that you took this effort in the release notes because even mentioning OS 3.0 is illegal. Coming to think of it, I have mentioned OS 3.0 now 5 times, I hope that Austria is to far off for Apple lawyers to serve me a cease and desist.

“But I meant it well! All in the interest of the community!” will be my famous last words when I will get dragged off to jail.

Date Closest to 'NOW'

Nagarajan asks:

I have needed a SQLite query that returns exactly a time which is very closest to the current time.

From 7:00pm,8:00pm, 9:00am and 10:00pm if the current time is 8:30pm, I will require 10:00pm.

This is more of a SQLite question than related to Cocoa Touch. But since SQLite is the mobile database engine of choice for Cocoa Touch, I’ll entertain this question as well. And follow it up with some Cocoa Code.

Read more

The Definitive List of Sales Report Tools

I am trying to convince somebody (other than myself) to do an in-depth comparison of all the ways you can download your app sales reports from iTunes Connect. I wonder why no blogger ever thought of this, clearly there lots of people with apps in the store and all of these are fed up with the crappy way of manually downloading the reports from Apple.

So far the only blogger who made an effort to compare sales report and ranking tools available was MarkJ.net. Another one can be found on MacStories.net.

All of these would benefit if we could nudge Apple towards creating a Web 3.0 open report download API. Because then we could compete on merit of our tools and not of who does the best marketing or who was able to fool Apple or not.

Read more

Build for OS 2.x and 3.0 at the Same Time

Let’s imagine I have this great MyBookshelf App and now with OS 3.0 coming I am planning to include Storekit so that my users can also purchase new content from within my app. So far, that’s a great idea. Additional features for my customers, additional income through in-app sales.

But maybe I have hundreds of thousands of users who are not immediately willing to upgrade to the new software. The reasons for this are outside the scope of this article but as an active developer you are risking loss of customers if you only concentrate on the new. 

Your choices are:

  1. make a final build for 2.x putting in all the bugfixes you can and then move on. Existing 2.x customers will only receive the latest 2.x version, new customers will have to have a 3.0 iPhone to purchase the new app.
  2. create a new app from the same codebase adding only the 3.0 features there and then continuing to push updates to both the 2.x version and the 3.0 version.
  3. create magic code to dynamically load 3.0 frameworks if they are present. This is highly advanced and only for true pros.

For this article I am focussing on option 2. I want one project to hold my source code and have two targets, one for 2.x and one for 3.0. Only the 3.0 version can include the appropriate 3.0-frameworks and I don’t want to see any compiler problems. Also I don’t want to resort to some fancy art of dynamic loading.

Read more

Adding Numbers to an Array

reembertoparada asks:

I have a loop from 1 to 30 and I want to create an NSArray with those values inside. Can you give me an idea on how to do this.

That’s an easy after-dinner exercise. First you need to take an NSMutableArray instead of an NSArray because regular objects without “mutable” in their class name cannot be changed. This is especially vital to know for arrays and dictionaries.

Read more