輸出應該輸出應該在那裏?
strString = değiştim
wkString = NULL
,但事實並非如此。爲什麼?
#import <Foundation/Foundation.h>
@interface learnARC : NSObject {
NSString *strString, __weak *wkString;
}
@property (strong) NSString *strString;
@property (weak) NSString *wkString;
-(void) yaz;
@end
#import "learnARC.h"
@implementation learnARC
@synthesize wkString, strString;
-(void) yaz {
NSString *anaString = @"anaString";
strString = anaString;
wkString = anaString;
NSLog(@"\nstrString = %@\nwkString = %@",strString,wkString);
anaString = @"değiştim";
NSLog(@"\nstrString = %@\nwkString = %@",strString,wkString);
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
learnARC *lrnarc = [[learnARC alloc]init];
[lrnarc yaz];
}
return 0;
}
什麼是輸出呢? – limon
這兩個NSLog語句應該產生輸出'「strString = anaString \ n nwkString = anastring」' –