[iPhone] Interface builder problem

Discussion in 'Mac Programming' started by cmaier, Jun 5, 2008.

  1. cmaier macrumors G3

    Joined:
    Jul 25, 2007
    Location:
    California
    #1
    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?
     
  2. tacoman667 macrumors regular

    Joined:
    Mar 27, 2008
    #2
    In Beta 6 and maybe 5, you need to subclass that object as UIViewController or UIView when using IBor you will get some seriously weird issues.

    Have you tried this?
     
  3. cmaier thread starter macrumors G3

    Joined:
    Jul 25, 2007
    Location:
    California
    #3
    i had tried using the actual viewcontroller that is created when creating the project, and had experienced the same problem. I will try changing the new class to subclass view or viewcontroller and see if that helps.

    I do remember on one of my experiments i at least got a stack trace, and got an "unhandled exception" crash relating to a message: CALayer:(..mouse up within bounds - can't remember the exact message). I thought it odd that CALayer was involved.
     
  4. cmaier thread starter macrumors G3

    Joined:
    Jul 25, 2007
    Location:
    California
    #4
    I tried subclassing UIView and UIViewController, and I still get that crash and the same console log.

    Actually, I also get this on the console now:

    [Session started at 2008-06-06 08:50:36 -0700.]
    2008-06-06 08:50:39.547 testib[8319:20b] *** -[UICFFont doIt]: unrecognized selector sent to instance 0x452d40

    [Session started at 2008-06-06 08:50:39 -0700.]
    2008-06-06 08:50:39.549 testib[8319:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UICFFont doIt]: unrecognized selector sent to instance 0x452d40'

    (more accurately: i got that message only one time. doing "build and run" again didn't show the message again).
     
  5. lordhong macrumors newbie

    Joined:
    Jul 13, 2008
    #5
    i'm having the same problem, were u able to fix it?
    i'm using the final SDK and latest mac os x update :confused:
     

Share This Page