Archive for November, 2008

iPhone SDK 2.2 - CodeSign Error

My weekend work plans were simple.

  1. Update iphone sdk to 2.2
  2. Write some more functionality for my FitTimer app.

Unfortunately the second part of my plan was never started because updating the SDK took most of my Saturday and Sunday.

The official update was not very difficult but after I have installed SDK 2.2 and updated my test devices I no longer was able to install my apps. I have gotten this nasty CodeSign error:

"CodeSign error: a valid provisioning profile is required for product
type 'Application' in SDK 'Device - iPhone OS 2.2"

I have done everything from adjusting project settings to regenerating certificates and provisioning profiles. I have not gotten much traction with any of my efforts. The solution came after I have found a post claiming there is a bug in SDK2.2 that causes for the project files to get corrupted.

So I have pulled out my trusty (MacVim) editor and opened up the: ProjectName.xcodeproj/project.pbxproj file and started snooping around.

I have found that I had multiple Build Configuration sections and my

"PROVISIONING_PROFILE[sdk=iphoneos*]" =
   "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

entry had a different number then my installed provisioning profiles.

So here are the steps to get it working again:

  1. SAVE YOUR WORK JUST IN CASE THIS SOLUTION DOES NOT WORK FOR YOUR PROBLEM
  2. Save your old project file.
  3. Go to ~/Library/MobileDevices/Provisioning Profiles
  4. Figure out which profile is the one relating to your project. Sometimes the profiles are saved with UUID as the file name so you may have to run grep with your project’s name to figure out which one it is.
  5. $ grep myAppName *
    Binary file xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision matches
    
  6. Copy the xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx number.
  7. Save your current work and close XCode
  8. Go to yourProjectDirectory/ProjectName.xcodeproj/ and using a text editor (MacVim for me) open the project.pbxproj file
  9. Find all "PROVISIONING_PROFILE[sdk=iphoneos*]“ entries and replace the assignment value with the number you have copied in step 4.
  10. Save the project.pbxproj file
  11. Reopen Xcode and recompile your projects. The CodeSign error should be gone.

I hope this helps and saves you a lot of time.

Good luck and if you have some time please check out my app: FitTimer

Updated: [important]
Please read Big3’s post https://devforums.apple.com/message/15497 and file bug report with apple. Send them your saved project file so they can figure out why XCode projects are getting corrupted.

FitTimer - staying fit and having time for other things.

I like working out, but I like a lot of things and working out usually does not make my priority list as much these days. I used to spend a lot of time in a gym. By “a lot of time” I really mean a lot of time. Some weeks I must have spend as many as 20 hours in the gym. I was really fit but I had absolutely no time for other things.

I have started to wonder why my workouts are taking so much of my time. What in those workouts take the time and if there is a way to workout as hard but in less time. I bought a stopwatch and started measuring where the time was going. As you may expect it was not going into working out. Most of my time was spent on breaks. Breaks could take up as much as 90% of my time in the gym.

90% seems like a lot of time, so I have stated to experiment with different break times and I have noticed that I did not need to take such long breaks.  For most exercises a 45 second break was adequate where others were ok at 60 seconds.  Needless to say stopwatch became a necessary accessory at the gym.  Yes one more thing to carry while I work out.

And then … Apple came out with the iPhone.  Thanks, Apple.  It is the device that has replaced 3 items I used to carry with me at the gym.  The phone, an iPod and the stopwatch.

I have written FitTimer to be the way to keep track of my breaks.  Simplicity and nice design where the top priorities during the design process.

It had to be simpler then a stopwatch. After all no one want’s to struggle with a program while they are working out.  Your focus should be always on working out and not on operating a device.  Tracking your workout should be almost incidental and not the primary goal of working out.

It had to look good.  As one of the “gym rats” I know full well that we are somewhat vain.  OK, some of us are really vain, but I am talking about the average “gym rat.”  We go to the gym to look good.  Why would we have an app in the gym that makes us look worse?  Well, we would not.

So here is what I came up with:

Simple, functional and elegant.

Now I can fit my workouts in under an hour.  That’s 2 hours I save every day.

I bet if you work out and not measuring your times you are wasting your time just I use to so if you have an iPhone or an iPod touch you can get the app at the apple AppStore: FitTimer

You can also see more screen shot on our company website: http://www.eideticsoftware.com/fittimer

Rails, tests and code coverage

“If it’s not tested assume it’s broken.” This is one of the mantras in my company. Sometimes it’s easier said then done. If I always had to test everything I would be doing nothing but testing. So I employ different techniques to keep me programming and the computer to test the code I write.

One of the nice things about Rails is that you have a whole array of tools to automate testing and at least one very nice tool to let you know what’s tested and what’s not. Yes I am talking about Rcov.

Rcov has been “the bee’s knees” for code coverage awareness. Recently I have noticed Rcov has been doing more work then expected. When I ran the rcov command in a rails project it tested everything. I mean everything, including gems installed on the system.

Since everything is just a bit too much for my project I started looking for a way to limit the output. It appears I had to use -x option to stop the code coverage tool from traversing the gems. Here is the whole task:

desc 'Measures test coverage using rcov'
Rcov::RcovTask.new(:rcov) do |rcov|
  rcov.pattern    = "test/**/*_test.rb"
  rcov.rcov_opts  = [
    "-x 'gems/.*,rubygems/.*,rcov/.*'",
    "-T",
    "--rails" ]
  rcov.output_dir = "rcov/unified"
end

I hope this helps you.