运行下面的程序,结果是怎样的?
//
// ViewController.m
// 拖拽按钮
//
// Created by 张闯 on 2018/12/12.
// Copyright © 2018 Rotai. All rights reserved.
//
#import "ViewController.h"
#import "ClassA.h"
@interface ViewController ()
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *age;
@property (nonatomic, copy) NSString *address;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
for (int i = 0; i < 1000; i++) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
self.name = @"123123123123123123";
});
}
NSLog(@"%@", self.name);
for (int i = 0; i < 1000; i++) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
self.age = [NSString stringWithFormat:@"%@", @"1231"];
});
}
NSLog(@"%@", self.age);
for (int i = 0; i < 1000; i++) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
self.address = [NSString stringWithFormat:@"%@", @"asdfsdfasdfadfadfa"];
});
}
NSLog(@"%@", self.address);
}
@end