Interesting Issue with iPods and Launching Your iOS App


This isn’t documented anywhere that I can tell but here’s what was happening.

I was testing a universal iOS app that I was working on and decided to just use the iPod Touch (iOS v4.2.1) I had out at the time. Unfortunately when I’d launch the app a black screen would appear with the standard status bar and nothing else. I put a breakpoint in application:didFinishLaunchingWithOptions and found that it wasn’t getting called. Strangely the app worked fine on my old iPhone 3g (iOS v4.2.1). I put the iPod aside and decided to come back to it later. Well today was later.

After playing around getting the app ready to submit to the app store I discovered that the same issue was appearing on my iPhone. After futzing around with it for a little bit I realized that I had deleted the “Main nib file base name (iPhone)” key from the application’s plist file. I restored the setting telling the app to launch “MainWindow_iPhone” and all was well but that got me thinking that maybe I didn’t test this properly on the iPod. I tried launching the app on the iPod and still no dice. I figured I was on the right track so for fun I added the “Main nib file base name” key into the plist file and set it to “MainWindow_iPhone”.

MAGIC!

So the end result is the app works on all devices now and I have three “Main nib file” keys in my plist. One for iPad, one for iPhone and one generic one.

Advertisements

Can RSS be replaced?


Prompted by parislemon’s post – RSS Is Dying, and You Should Be Very Worried – and subsequent twitter feud I’ve decided to try and get away from RSS completely. I’ve found myself in the past spending way too much time on Google Reader and probably not getting the information I needed quite as readily. I wondered if I can get the same information on twitter – and potentially get access to better information – and do so in a more efficient manner.

So I took some time yesterday evening to look at my RSS subscriptions and see if I can just follow their twitter feed to get the same information. So I’ve managed to cut my number of RSS subscription in half but I haven’t gone through a lot of the more obscure feeds. Some I expect not to be able to remove entirely but if I can streamline my whole information gathering process hopefully I can spend some more time on better quality pursuits (reality tv shows).

I think the toughest part of this whole process for me will be getting used to clicking links as opposed to reading posts in Google Reader. The other difficulty will be finding a way to keep track of where I left off on my twitter feed. I’ve switched my casual browser back to RockMelt for now since the TweetDeck Chrome app didn’t show you which tweets were new but am on the lookout for a better way to manage what information I may have missed when I’ve been away from a computer/phone/tablet.

So what do you think? Should I even bother or has RSS run its course?

Ripple Effect on the iPhone


So on this iPhone App I am working on I am trying to create an effect on a image such that if you touch any part of the image the app will simulate a water ripple effect out from the touch point. After a few hours of research it became clear to me that I would have no choice but to attempt this effect using OpenGL ES which I had been trying to avoid. However I discovered this excellent tutorial complete with project template that made things a lot easier:

http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html

Using this tutorial I was able to create my texture map and apply an image to it. From there it just became a matter for coding the ripple effect. Here is what I came up with:

-(void)update:(float)time{ int i;  for( i = 0; i < (80*120*6); i++ ) {  int index = i * 3;  float *vertArray = (float *)originalVertices;

  Vertex3D v = { vertArray[index], vertArray[index+1], vertArray[index+2] };
CGPoint vect = CGPointMake(position.x - v.x, position.y - v.y);  CGFloat r = sqrtf(vect.x*vect.x + vect.y*vect.y);

  if ( r < radius )  {   r = radius - r;   CGFloat rate = powf( r / radius, 2);   v.z += (sinf( time*(CGFloat)M_PI*waves*2 + r * 0.1f) * amplitude * amplitudeRate * rate );
}

  float *vertArray2 = (float *)vertices;  vertArray2[index] = v.x;  vertArray2[index+1] = v.y;  vertArray2[index+2] = v.z; }

}

I still have a ways to go to finish it but here’s what is going on so far. First I’m looking through all of my vertices in my texture map. My texture map is 80×120 and for each point I am actually am creating 6 vertices to render a square. I know this can be optimized using GL_TRIANGLE_STRIPs but I’m not there yet. Then I create the vector and distance (r) from the touch point.

Assuming I am within the radius of the ripple I defined (which I could make dynamic down the road based on touch time) I then calculate the new depth (z) of the vertex I am on using the amplitude and other values that were set previously. After that I just update the vertices to render with the new values and it’s good to go.

I still have to handle multiple touches and other factors but what I ended up with so far is pretty cool. I’ll post a video of the effect once I’m done.