Any Difference between iOS/Mac Developing?

Discussion in 'iOS Programming' started by benkenobi, Oct 17, 2012.

  1. benkenobi macrumors member

    Joined:
    May 27, 2009
    #1
    I've created mac apps before, and tried to create a simple app for iOS It just displays Hello world in a label after pressing a button.

    For some reason it crashes with a EXC_BAD_ACCESS or SIGABRT error. Is this a xcode problem?

    All I did was create a new object, with a custom class that inherits NSObject, (tried to inherit UIViewController also with no luck). The controls are connected correctly . What could I be doing wrong here? :confused:

    The code and error info: (its really short)

    MAObject.h:
    Code:
    #import <Foundation/Foundation.h>
    
    @interface MAObject : NSObject {
      IBOutlet UILabel *displayText
    }
    
    -(IBAction)helloWorld:(id)sender;
    
    MAObject.m:
    Code:
    #import "MAObject.h"
    - (IBAction)helloWorld:(id)sender{
       [displayText setText:@"Hello World"];
    }
    
    Error info:
    Code:
    [__NSCFString helloWorld:]: unrecognized selector sent to instance 0x6842010
    2012-10-18 02:54:19.686 TestApp[33418:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString helloWorld:]: unrecognized selector sent to instance 0x6842010'
    
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State

Share This Page