With the latest version of Xcode from Apple, I have the following problem.
Upon launching,开发者_开发问答 and starting a new project, no matter what the project, I get an error.
Let's say I would like to build a "Mac OS X Command Line Tool" of type "Foundation".
Then, to add a new class, I go to File > Add File > Cocoa Class > Objective-C Class (subclass of NSObject).
Next, in the .h file of the new class created, I replace with the following code:
//
//  newclass.h
//  Untitled
//
#import <Cocoa/Cocoa.h>
@interface newclass : NSObject
{
    string userName;
}
@property string userName;
@end
And then the implementation with the following code:
//
//  newclass.m
//  Untitled
//
#import "newclass.h"
@implementation newclass
@synthesize userName;
@end
And then click "Build & Run" the following errors occur:
newclass.h:11: error: expected specifier-qualifier-list before 'string'
newclass.h:14: error: expected specifier-qualifier-list before 'string'
newclass.m:11: error: no declaration of property 'userName' found in the interface
What am i doing wrong? I've looked up similar previous questions and they have all had to do with the fact that there have been missing or incorrect inputs as far as I can tell.
I can't seem to find out how mine would relate considering everything is from a new project.
I think you're looking for NSString *.  string is a C++ class and Objective-C is not C++.
The string type hasn't been defined.  I think you meant to use NSString * 
Try change your .h like this
@interface newclass : NSObject
{
    NSString *userName;
}
@property (nonatomic,retain) NSString *userName;
why your implementation looks like your .h ..... ?
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论