Posts Tagged Software_Development

XCode 4 – Stopping in the Debugger on NSAssert

I’m not sure if XCode 4 makes this technique unnecessary. Since I originally wrote this, I’ve seen XCode 4.0.2 stop at NSAssert on its own, without me setting this breakpoint. But it may be helpful to someone somehow. So here it is:

Xcode 3: Run Menu -> “Manage Breakpoints”
XCode 4: Go to the breakpoint navigator.

Click the + button at the bottom of the navigator, select “Add Symbolic Breakpoint…” from the contextual menu that appears.

In the “Symbol” box, enter

-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:].

Then click “Done”. (NOTE: this is the default assertion handler. If you are using a custom assertion handler, you probably need to specify a symbol for its object and method.)


Now execution will break immediately on assertion failure. And very usefully, XCode shows the nearest source code of the stack, not the assembly of the assertion handler.

Tags: ,

XCode Problem “expected specifier-qualifier-list before

Solution:  check that you included appropriate frameworks in your project and target.

I had this just now while building a new project and forgot to put the frameworks into the project.

Tags: ,

XCode Giving Incorrect Error Messages after Upgrade to 3.2.2

A few days ago,  I was helping upgrade a Mac’s XCode environment from 3.1.4.   After the upgrade, the first attempt to build and run a project resulted in strange errors.  ”Security Policy Violation”  came back from the device along with problems with the entitlements.

After much poking and prodding, I noticed that the Base SDK for the project was set to “iPhone OS 2.0 (missing)”.  The base SDK for the project was no longer available in XCode after the 3.2.2 upgrade.

Resetting the BaseSDK to 3.0 solved the issues and the build and run was fine.

Tags: , ,

iPhone Pattern: The ID Device?

I’ve seen stories lately that make me think another app pattern is emerging: iPhone as an ID. (Not news to you? Gotta love intelligent readers.)

It does make some sense.  In cases where serious identification is not crucial, the iPhone can be used.  With a full iPhone, you can bet people don’t just loan them out to people indiscriminately.   On days when I’ve forgotten my wallet, I still didn’t forget my iPhone.

Think about these:

  • Companies are sending account information, such as passwords or password reset info to the mobile phone recorded in the account.
  • RSA has a “SecurID” app for the iPhone.  Its used just like the cards and keychain dongles that give a code number once a minute.  That’s 2-factor authorization.
  • iPhone and iPhone apps are being used to pay for physical goods and services. A hotel reportedly issues iPod Touches to guests.  The guests uses them to order food and drinks by the pool and pay on the room account.  (They give the devices back at checkout time.)
  • Apps are used to exchange contact information.

Tags: , , , ,

Mysterious iPhone status bar icon?

Last night I was attending the iPhone SIG of the Florida Macintosh Users Group (FLMUG).

One of the members was asking about an icon in his status bar he couldn’t identify.  It looked like a landline telephone’s receiver with a keyboard underneath.  We scratched our heads for a minute until Phil said “wait, that’s gotta be the TTY setting”.  He quickly looked in Settings under “Phone” and yes, the TTY setting was on.  The icon went away when the setting was turned off.

Kudos to Phil for deducing the answer based on the “phone” and “keyboard” clues.

So today, I had to go lookup the other icons which may be displayed, just in case. :-)  They are listed by Apple as “status icons” here: http://support.apple.com/kb/HT1558

Walt

Tags: ,

iPhone App Approval Took 12 Days

I got my first iPhone app,  ChronoGami, approved for download on the App Store.  And, the approval process did take 12 days from submission to approval.

There’s a lot more to the story than that of course.  I have worked on apps for other people that have shipped out through the App Store before ChronoGami.  But I began work on ChronoGami before I worked on those, so I still think of it as my first app.  I use it myself to track time on various bits of work and my life.   (I’ve got several upgrades to deliver when I finish testing already.)  I intend to be using ChronoGami exclusively for this in the near future. Adjusting to the iPhone keyboard still proves to be a challenge for note-taking.

An ironic part of the story that makes me laugh:  I checked the status of ChronoGami just before leaving for an interview to talk about possible Mac and iPhone work.  Late in the interview, during a break, I got online and checked again.  It had been approved!  Now I had one more point to talk about in the rest of the interview.  :-)

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: , , ,

default.png won’t display

Funny one today:  my default.png file would not display.  My application launched with a black screen zooming out instead.  A quick look at another app that did work properly showed the only difference: the “D” was capitolized.  A quick check and sure enough, it worked if the D was upper-case.

That was a surprise to me, being so used to the case-insensitive file system on the Mac for so long.

Tags: ,