預警myObject.h
:目標C:編譯器與枚舉
typedef enum {
GET,
POST
} HTTPMethods;
然後是@interface
定義中,一個屬性:
@property (nonatomic) HTTPMethods *httpMethod;
在myClass.m
,我有myObject.h
然後#import
:
myObject *obj = [[myObject alloc] init];
obj.httpMethod = POST;
This似乎工作,但編譯器大聲對我說:
`Incompatible integer to pointer conversion assigning to 'HTTPMethods *' from 'int'.
我在哪裏錯了?