Problem with Xcode 6 GM

Discussion in 'Mac Programming' started by Loge, Sep 15, 2014.

  1. Loge macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #1
    When creating a new OS X Objective-C project with Xcode 6 GM (in Mavericks), I am not able to compile the project as soon as I create an action (or outlet) for an interface object. For example if I try to create an action for an NSButton object, I get the error in my controller header file

    Parse Issue, Expected a type

    at the line

    Code:
    - (IBAction)calculate:(NSButton *)sender;
    No problems at all if I do exactly the same thing in Xcode 5.1.1.

    Anyone see this, or know what I might be doing wrong?
     
  2. blueillusion macrumors member

    Joined:
    Aug 18, 2008
    #2
    Try using Xcode 6.1 Beta 2 from the mac developer page.
    Xcode 6.0 is only GM for iOS
     
  3. Loge thread starter macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #3
    Thanks. Same problem happens in the new beta. It seems the required frameworks are missing when creating an Obj-C project instead of Swift.

    I can continue in 5.1.1 for now.
     
  4. mwfire macrumors newbie

    Joined:
    Jun 25, 2011
    #4
    You have to add
    Code:
    #import <UIKit/UIKit.h>
    manually to the header file whenever it is missing at a view. Seems to be the case with the XCode GM.
     
  5. Loge thread starter macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #5
    This is for an OS X project rather than iOS.

    Discovered that in my controller class, I needed to import the Cocoa header,

    Code:
    #import <Cocoa/Cocoa.h>
    instead of the Foundation one that was included in the code generated by Xcode.

    Code:
    #import <Foundation/Foundation.h>
     
  6. NibsAndXibs macrumors newbie

    Joined:
    Oct 11, 2014
    #6
    I think new projects omit the pch in objective c based projects in Xcode 6. So that may be the issue you are having. Adding a pch manually is easy, it's a file template still. Just remember to go to the corresponding targets build settings and fill in the path to the file. Filter by "prefix" in build settings search bar for your target to find the appropriate field. Hope this helps!
     
  7. Loge thread starter macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #7
    Thanks :) That's exactly it, hopefully they will fix the template at some point, though as you say, easy to do manually.
     

Share This Page