I've written a few iphone apps the old-fashioned way (i.e.: no IB), and haven't played around with IB for iPhone apps until today (didn't feel the need to rewrite my existing apps to take advantage of it). But I seem to be doing something wrong. This is with sdk beta 6. I do the following:
- in xcode, create a new "cocoa touch application."
- load "testibViewController.xib" in IB
- drag over an Object from library
- in the info pane for Object, change its class to testdel and add a doIt action
- File | Write Class Files, and add to the project
- Edit testdel's doit like this:
- (IBAction)doIt {
NSLog(@"hello");
}
- drag a UIButton over to the View
- control-drag from the button to Testdel, and select the doIt action
- fix testdel.h to make testdel subclass NSObject
- "build and go" (for the simulator)
In the simulator, i click the button. Program crashes. This is in the console:
[Session started at 2008-06-05 20:18:38 -0700.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/cliff/Library/Application Support/iPhone Simulator/User/Applications/76C6DE6D-FAE0-422B-975E-A6C75CACA04F/testib.app/testib', process 6941.
(gdb)
I'm assuming I'm missing something simple here. Anyone know what I'm doing wrong?
- in xcode, create a new "cocoa touch application."
- load "testibViewController.xib" in IB
- drag over an Object from library
- in the info pane for Object, change its class to testdel and add a doIt action
- File | Write Class Files, and add to the project
- Edit testdel's doit like this:
- (IBAction)doIt {
NSLog(@"hello");
}
- drag a UIButton over to the View
- control-drag from the button to Testdel, and select the doIt action
- fix testdel.h to make testdel subclass NSObject
- "build and go" (for the simulator)
In the simulator, i click the button. Program crashes. This is in the console:
[Session started at 2008-06-05 20:18:38 -0700.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/cliff/Library/Application Support/iPhone Simulator/User/Applications/76C6DE6D-FAE0-422B-975E-A6C75CACA04F/testib.app/testib', process 6941.
(gdb)
I'm assuming I'm missing something simple here. Anyone know what I'm doing wrong?