Posts Tagged Macintosh_Development

iPhone Ad-Hoc distribution problems

Well,  an interesting bit of problem-solving today.

I sent a revision of an app to a client with ad-hoc distribution.  It installed just fine on one device, but would not install on the other. (The one that was going to be used to demo the product.) I double-checked that both device IDs were properly included in the provisioning profile.

After some quick re-reading, I thought the (cryptic) error might be that I forgot to send the .mobileprovision file along with the app.  One of the instruction lists showed installing the profile manually.  But when the file was emailed and isntalled, iTunes asked if it should replace the existing provisioning profile. It probably came from the app (which has a embedded.mobileprovision file in it.)

iTunes doesn’t show any information about installed profiles (that I could find) so it wasn’t clear if the provisioning profile was actually on the device.  A quick download of the iPhone Configuration Utility cleared that up.  It showed information similar to  XCode’s organizer, including the provisioning profile.

As it turns out, you can’t just send a .zip of your app straight to a Windows computer like you can on the Mac.   I haven’t seen an explanation anywhere, but it might be that the bundle contains files or folders with names that are not Windows-friendly.  Both contain a symlink file, but they seem the same.

The solution it seems is to process the app bundle into an .ipa file.  The easiest way to do this is to drop the bundle on iTunes. It will process the bundle into an ipa file.  Just control-click on the app to pull up the contextual menu and choose “Show in Finder”.   (Or go find it in the iTunes folder.)  Send that ipa file to your ad-hoc Windows users and they can drop it into their iTunes.

The errors from the iPhone log:

unknown mobile_installationd[1347] <Error>: 00808a00 install_embedded_profile: Skipping the installation of the embedded profile
unknown mobile_installationd[1347] <Error>: unrecognized status -67068 from codesigning library
unknown mobile_installationd[1347] <Error>: 00808a00 verify_executable: Could not validate signature: e8008001
unknown mobile_installationd[1347] <Error>: 00808a00 preflight_application_install: Could not verify /var/tmp/install_staging.Pav7Nw/foo_extracted/Payload/
unknown mobile_installationd[1347] <Error>: 00808a00 install_application: Could not preflight application install
unknown mobile_installation_proxy[1346] <Error>: handle_install: Installation failed
unknown mobile_installationd[1347] <Error>: 00808a00 handle_install: API failed
unknown mobile_installationd[1347] <Error>: 00808a00 send_message: failed to send mach message of 64 bytes: 10000003
unknown mobile_installationd[1347] <Error>: 00808a00 send_error: Could not send error response to client

Tags: , ,

iPhone Developer Group Meetings in Orlando

I was surprised recently to see how many groups are starting up around iPhone development in the Orlando area.  I’ll compile my list into a page and see how it works out.

I’ve attended two meetings and enjoyed both greatly.  The levels of focus, curiosity, and participation were great.  The discussions of just development challenges in general were also very good.

  • NSCoder Orlando (site twitter)   – meets every Tuesday
  • Mac & iPhone Developer Meetup (site twitter)  –
  • Orlando Cocoa-Heads  (site twitter)  – 2nd Tuesdays suggested, but still variable

The Panera’s restaurant downtime for the Mac & iPhone meetup group was pretty tough to find parking near, so go with a little extra time for that. Maybe take $5 or so in cash if you have to pay for a parking space.   That Panera’s does close at 8:30 pm.  While they are very gracious to people lingering, you won’t be able to get in or buy anything after that.

If you are more interested in a group for simply using the iPhone, check out the meetings of  the Florida Macintosh Users Group.  All the meetings wind up talking about iPhones at some point, but some will have different focus.

  • FLMUG main meeting (site twitter)
  • iPhone SIG (special interest group)  (site twitter)
  • FLMUG Business SIG (site twitter meetup)

Tags: , , , ,

I told XCode to forget it, but it can’t

Another XCode bug brought to light thanks to the product “Little Snitch” (mentioned in my phone-home post),  I sometimes see a notice that XCode is trying to connect to the SSH port on an IP address I no longer use.   I can’t make it stop.   I just hope that whoever has the address now doesn’t track me down and send the Feds.  (That would be like worrying about a snowflake in a blizzard I’m sure.)

XCode was once setup to connect to my home IP address to get to the Subversion server I had there.  At a certain point I stopped using that server and started using repositories on my laptop because now I’m often unable to connect back to the house. (And because I wanted to shutoff the massive tower to lower my massive electric bill. )

I removed the IP address from my list of repositories under SCM Preferences, and the address is not listed under the SSH tab in that preference pane either.  A search of the XCode preference file turned up empty.  But somewhere that address is still remembered by XCode.

Tags: , , ,

XCode Crashes if it can’t phone-home

I’ve had trouble lately with XCode crashing immediately after an error trying to communicate with Apple’s servers.

I don’t know quite what’s happening, but i have Little Snitch installed on my Mac and I often work in Starbucks or bookstores where paid WiFi is available.   Somehow, being denied its chat with Apple makes XCode crash.

Little Snitch is a cool piece of software.  I bought it in one of those bundle deals from MacHeist or MacUpdate.  But its alert every time an unexpected communication attempt is made can be quite eye-opening.   However, I learned quickly to not deny XCode when it tries to talk to Apple.  The first time I did that, XCode crashed immediately and took my text changes with it.  (Not much work lost thankfully.)

I still make Little Snitch ask for permission for all XCode communications so I can see when they happen.  If I don’t press the “Allow” button before the attempt times out, XCode may or may not crash. I give permission as fast as possible so it won’t crash.

In the past few days though, XCode has still crashed, even with permission given in under 5 seconds.  I’ve begun to wonder if it might be a problem with router used by stores to get logins before allowing traffic out to the internet.  If XCode is denied at that point, will it still crash?  I don’t know yet.   But since such WiFi spots allow the computer to connect, it may look like you are on the internet when you aren’t.  Communications will fail.

Thankfully, it doesn’t try very frequently.  If it did,  it would be too frustrating to deal with all the crashes.  I also note that the XCode Console output shows a crash report submitted to Apple,  so I assume they don’t need another bug report on it.

Tags: , , ,

Helping XCode find its files

I started moving files around in my project folder recently.   I wanted to re-organize code and non-code files into different folders.

Once the files had been moved and the project re-opened, there are many source files displayed in red, meaning XCode does not know where they are.

To help XCode find missing files, try this:  select the red file,  perform “Get Info”, select the “General” tab and click the “Choose…” button.   You can then find and pick the file.  You can even change the file if you like.

Warning:  when you are doing this with a missing file, it is possible to substitute a folder for the file.   If you manage to do this, you won’t be able to just re-choose the file.   You’ll have to delete the folder and re-add the file.

Tags: , , ,

Executing Terminal Commands Inside Xcode

A long time ago,  I remember using Apple’s MPW environment to create software for the Mac.   This environment was a lot like using terminals had been on the Unix machines back in college. This had its plusses and minuses but it was strange in one fashion:  I could execute command-line scripts inside the text editor.  This ability has returned in Xcode.  (Well, I just noticed it recently due to a lucky accident. It may have been there all along.)

The default setup for Xcode uses Control-R (and variations with Option or Shift keys) to execute the currently selected text as a bash terminal command. If no text is selected, the entire line containing the insertion point is used. You can change which key does this in Xcode’s “Key Bindings” preference panel under the “Text Key Bindings” tab.  (Note that the variations are listed in the bindings panel mentioned.)

This can have many small, cool uses.   Here are a few off the top of my head:
this will give you a timestamp like this one: “Fri Jul 17 14:04:02 EDT 2009”
“ls” will list directories of files directly into your text file – this can be useful if you are looking to put a file name into a file open command or  something

If you have a useful command-line tool whose output would be useful in an Xcode text file, this will work for you.

What you can’t do is run programs that don’t stop or require further input, like TOP or SSH.  For those, you’ll still need to use the terminal program supplied with your computer.   If you do try this,  you will cause problems for Xcode that will probably lead to it locking up or crashing.

I tried this with “top” and Xcode started having difficulty editing the file any further.  Other things seemed to work, but it eventually crashed.  As I figured out later, a “top” process had started.  The second time, I found it in the process list and used “kill” on  it from the real terminal.  The moment I killed it, the Xcode window filled with a ton of output generated by TOP.

In another case, I tried to use the SQLite3 tool, but it just quit with this error: “Incomplete SQL”.  So interactive tools don’t work for this.

Of course, its easy to capture the output of command-line tools for text files in different ways, so this is cool, but not really earth-shaking.  It can make some work much quicker and easier.   Enjoy.

Tags: , , ,

A Technique for Finding iPhone App Crashes at ojbc_msgSend

(if this helps you, even to save a little time, please leave a comment)

Recently, I was working on an iPhone application for a client when I ran headlong into a crash in objc_msgSend.  It was a hair-pulling bit of frustration for me as it seemed so hard to debug for a long time.  Every time I encountered it, this was all I saw on the stack:

Debugger Stack for objc_msgSend problem

Debugger Stack for objc_msgSend problem

I saw several posts online which gave me more than few hints.  It seemed very clear that I had over-released something, but all the zombies and other flags didn’t really make it clear which thing was getting over-released or where.  I could tell what it was, but nothing much else until I struck on this idea while taking a walk:  if the crashes are always related to the release of an auto-release pool, then I need to control the auto-release pool. I can’t wait for this _NSFireDelayedPerform thing to decide to release it. (Steve Maguire’s  “Writing Solid Code” has been one of my favorite industry books for a long time.)

So in essence, I started bracketing all my suspect code like this:

Sure enough, my debugger stacks went from looking like the one above to looking like this:

Debugger Stack With Manual Pool Release

Debugger Stack With Manual Pool Release

That’s a LOT better. Now I know where to look.  Further application of layers of pools narrowed down the target pretty quickly.

In the end,  I found that my mistake was a call like this in an initializer:

which isn’t wrong.  However,  I never actually filled the allocated array entries.  When it was released later, it caused my crash.  Changing the code to to allocate the array later, when I had items to fill it,  fixed the problem.

There is one little problem with this technique that I see: you have to be careful how you bracket things with the pool-release calls.  If you release a pool, then try to use something that was allocated on that pool, you may be trying to use something you’ve already released.  The easiest way I saw to use it was to put them around a call to a routine or a message.  When I had to use them inside a block of code, I had to be careful that allocations and releases that used the pool would all be inside the bracketing calls.

I hope this helps someone else find a solution.  If it did, please leave a comment.

Tags: , ,