Category Archives: techb

New Provisioning Profile Not Working: Fix

My Provisioning Profile for my iPhone app expired, so I renewed it, downloaded it.  Added it into Xcode.  Manually added it to ~/Library/Mobile Devices.  It would build and install onto the device, but when launched via the debugger I received the following output:

Error launching remote program: security policy error.

The app would terminate, the debugger was running but not attached to any process.  The fix that finally resolved it was going to Settings > General > Profiles on the device and removing all of the expired Profiles in there.  (Which were not related to the app in question.)

Checkers FS5 Free Pulled From Store

After waiting for Checkers to be pushed into the store from the queue, and watching it’s soft launch this weekend, we noticed some anomalies in the ratings.  We’ve come to have certain expectations of the ratings.

The Checkers FS5 Free was receiving an inordinate number of low ratings.  No comments explaining or support emails about it.  Unfortunately, this is typical of users.  Only one of our team members has a 2.0 device we can use for testing.  He launched it and immediately found the problem.  A slight timing issue with some of Apple’s libraries causes the game to hang when you start to play it.

There are still quite a few 2.x iPod Touches, and they are particular in their game play.  We had to make the decision on whether to pull it or not, it was touch, but that’s what we decided to do.  The simple workaround should be back in the app store queue by the end of the day, but it may be a while before it sees the light of day in the app store.

We’re sorry for the delay, and in the mean time if you want our checkers you’ll have to pay for it.

Versions and svn merge

We had a project that included extern links to many subprojects. (They were subprojects because we use them across several projects.) The subjects had a iPhone 3.0 branch created for them, and developed against the new SDK. Out of laziness, we redirected the extern links to the 3.0 branch when it was desired.

In reality, we should have created a 2.x branch, and forced existing apps to change what they were looking at or use the new 3.0 code. But we didn’t.

Now, it was time to merge the 3.0 branch back into the trunk of our development. Version provides a realy nice GUI to most of your day-to-day svn needs. But a major merge is not an everyday need, and needs some human interaction. (Though I do think they could supply a “merge repository branch X into workarea branch Y, and let me handle it from there”.)

The first thing to do is change the external settings to where you want them to be pointing when you’re done, trunk in our case.  You can do this from Versions in the externals part of the inspector.  Then re synchronize the project.  At this point it likely won’t build.  We need to move the code from the branch repository into our trunk work area.

One trick before merging is determining at what point the branch split from the trunk or was last copied from the trunk.  I have a work area with the entire subproject branching structure sync’ed to it and you can select each of the two and show their history, and compare the commits.  The last common commit is what you are interested in.  Mine was 158.

so, you’ve changed directory to the trunk work area, the money command is:

svn merge -r 158:HEAD <branch-workarea-path> --username <remoteuserid>

it will ask your password more than once, keep giving it,

it may ask you a merge question, i always postpone, it provides standard in-file diffs you need to handle,

Select: (p) postpone, (df) diff-full, (e) edit,
(h) help for more options: p

After handling the diffs, check it in.

Store Kit: Micro Payments

When Apple announced their iPhone 3.0 software, they announced an API called StoreKit. This is a small collection of interfaces to facilitate purchases via Apple. It is, of course, still subject to the 30% cut by Apple – they are about to become even richer on the App Store. (Since they are not providing hosting of content as they are with the apps, it seems they should shrink this 30% to 20% or so!)

They suggested it might be used to buy new levels in a game (in which case you would download the content from the App developer’s server) or provide subscription based content (6 more months of the magazine, for instance).

For the 2008 season, Major League Baseball provided an application for $5. They had to provide a new app (to get the revenue) for the 2009 season. This will prevent that kind of requirement, as well as allow perhaps “buy game audio for $1 – video for $2” allowing you to download the game of your interest.

But what if they want to charge less than $1? They can keep a running balance. 5¢ for that content? Of course, you now have 95¢ left in your balance.

I can totally see The New York Times and other newspapers trying out a micropayment system. How about 1¢ for every article you download? Keep a $5 buffer to keep the payments less frequent. Charge a $1 for the app and give them $5 of credit.

I fully expect someone to try out the micropayment scheme. I am really interested to see if anyone succeeds with it.


I consider an API a collection of interfaces, Apple and their “over a 1000 new APIs” seems to consider it a single method or function, which would of course be useless by itself.

Note: FlipSide5 does not have any plans to institute micropayments.

Tracking Through iPhone Source

There are many better ways to trace through your code in any environment than with print statements.  If there’s not, you need to change jobs (or convince them to choose an environment that won’t waste all your time chasing bugs).

Your first order of business should be to familiarize yourself with your debugger.

However, there are times that you want to track through the code without having to break.  Watching what is going on in some event code is a good example.

You may often want to print out what method you are executing when in Cocoa Touch (or plain Cocoa for that matter).  If you are new to the iPhone and/or Objective-C you may not be aware of the two “silent arguments” that get sent to every message that dispatched in the Objective-C runtime.

You can think of the methods as C functions that receive all the arguments you see in the Objective-C code, plus two others.  The first is self, which you should be familiar with.  You may have thought it was a language keyword with supernatural powers.  In reality, it is the first argument to your method.  It’s always named self, and it’s of type id – i.e. it can be any kind of object.

The other is a selector, which is type SEL. It is named _cmd, and just like self you can use it anytime you’re inside a method. Though the preceding underscore should give you a hint that it’s use is expected only in uncommon circumstances.

All this is a long walk back to the point. If you want to print this information out, rather that retyping every method name, and mistyping them, and not changing them when the names change, and copy-paste-erroring all over the place, you can have cleaner and more maintainable code using the _cmd value.

A SEL is not an object, it is an opaque type. So we’ll need to convert it into something we can print. There’s a nice “function” defined for that.

Some example uses:

NSLog(@"[%@ %@]", [self className], NSStringFromSelector(_cmd));
NSLog(@"%s: [%@ %@]", __FILE__, [self className], NSStringFromSelector(_cmd));
NSLog(@"%s %d: [%@ %@]", __FILE__, __LINE__, [self className], NSStringFromSelector(_cmd));

Of course the first example won’t tell you what file it’s in. You may have a subclass instance running through a superclass’ code. If you really want to know the file or the line number, the later examples show you how to take advantage of the C precompiler values to do that.

There are a variety of other uses for selectors. Objective-C’s dynamic dispatching can allow some very powerful behaviors with them. But that’s for another day.

Note: [object className] is not defined in the iPhone on-board library.  You’ll have to replace the [self className] with NSStringFromClass([self class]) for it to run natively on the iPhone OS.

Category in Page

I hacked into the page.php file, tested for the page I wanted to convert, and added the LOOP code from category.php file to run instead when it hit that page. I also had to reset the query when that occurred.

The pages are kept in the wp_post table and their post_type='page', That’s how I found the page number I wanted to check for.

 <?php if (is_page('738')) : /** Tech Page = post 738 **/ ?>
 <?php /** Change the query before the loop starts for the tech page **/
   /** category tech=4, techb=54 **/
   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
   query_posts(array('category__in'=>array(4,54),'showposts'=>10, 'paged'=>$page));
   /** query_posts('category_name=techb&showposts=10'); **/ ?>

 <?php if (have_posts()) :  /** THE LOOP - CATEGORY **/ ?>
 ...

The one thing that’s not working is the “older/newer” links at the bottom. They come from the following code, and I’m not sure if I need to change it, or (more likely) change the modified query above to somehow take into consideration what page it’s on. Pagination? Anyone?  Found solution, and included above.

 <ul class="prevnext">
   <li class="newer"><?php previous_posts_link('Newer Posts'); ?></li>
   <li class="older"><?php next_posts_link('Older Posts');?></li>
 </ul>