tags:

views:

2387

answers:

4

I have an iPhone app that compiles and runs fine in the Simulator on my laptop. Now, I try to build and run the same code in the Simulator on an iMac, and it starts up and lets me click a button, but then I get an assertion failure.

Here is what is in the console:

*** Assertion failure in -[UILabel setFont:], /SourceCache/UIKit/UIKit-738/UILabel.m:438
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: font != nil'
Stack: (
2493366603,
2432871995,
2493366059,
2459146836,
817183141,
817926218,
837317240,
837317032,
837315376,
837314643,
2492860866,
2492867620,
2492869880,
85304,
85501,
816175835,
816221412,
9096,
8930
)

Here's the stack trace:

#0  0x949dbff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___
#1  0x9102ae3b in objc_exception_throw
#2  0x94962ad3 in CFRunLoopRunSpecific
#3  0x94962cf8 in CFRunLoopRunInMode
#4  0x00014d38 in GSEventRunModal
#5  0x00014dfd in GSEventRun
#6  0x30a5dadb in -[UIApplication _run]
#7  0x30a68ce4 in UIApplicationMain
#8  0x00002388 in main at main.m:16

My code does not make any direct calls to setFont:. However, this would be the point in the program's execution where some buttons are made visible for the first time.

I've Googled. A few people with similar problems say that this gets magically fixed when they edit the NIB, or change their time zone, or other weirdness.

Any ideas what the real cause is?

(Please no whining about NDA's.)


Update: If I change the font of some of my buttons from "TimesNewRomanPS-BoldMT" to "Times", then the assertion failure no longer occurs. But why can't I use the desired font, which exists on the iPhone, is installed on the new machine, and is selectable in Interface Builder?

+1  A: 

If you've got UILabels in your xib file, they may be somehow corrupt, or you may have set a font to them that doesn't exist on both your machines (you can use command-T when editing a UILabel to bring up the font picker; not sure it's possible to set a non-iPhone font, but it may be). Otherwise, try removing UILabels from your xib file until it runs, and there's your culprit.

Ben Gottlieb
If I change the font of some of my buttons from "TimesNewRomanPS-BoldMT" to "Times", then the assertion failure no longer occurs. But why is that? And why can't I use the original font, which is installed on the new machine, and is selectable in Interface Builder?
Kristopher Johnson
+1  A: 

And if it's not a UILabel, it may be a UIButton (which contains a UILable), etc.

William Denniss
A: 

Not all are available in the iphone, only certain fonts.

A: 

Had the same issue but in a special situation. Only when code was compiled for iOS 4 but deployed on device with 3.1.3 Removed Arial-Narrow and it worked.