内存规则理解
当通过 [NSString stringWithFormat:@"biubiu李2017_C"] 创建一个对象时,这个对象的引用计数为 1 。而当使用局部变量 strB 指向这个对象时,这个对象的引用计数 +1 ,变成了 2 。而出了当前作用域时,局部变量 strB 变成了 nil ,所以其所指向对象的引用计数变成 1 。当出了 @autoreleasepool {} 的作用域时,当前 autoreleasepool 被 drain ,其中的 autoreleased 对象被 release 。所以这个对象的引用计数变成了 0 ,对象最终被释放。
    */
    @autoreleasepool {
        //[NSString stringWithFormat:@"testing"]  1  stringWithFormat 中返回 [nsstring autorelease];
        //        NSString *str = [[NSString stringWithFormat:@"testing"]retain]; 2
        NSString *str = [NSString stringWithFormat:@
                         "testing"];
        //weak 引用计数不改变
        stringA = str;
        //[str realse];
    }
    //str 出了作用域,引用计数减1
    //autorelease对象经过自动释放池,减1 ,此时为0
Thread与autoReleasePool
thread创建需要创建autoreleasePool么
答案:iOS7之后不需要了,新创建的线程中如含有autoRelase对象系统会自己创建自动释放池
NSThread创建需要创建runloop么,线程内的任务是执行完就消失了么,如何线程保活?
答案:默认thread执行完任务就消失了,如果想线程常驻,需要添加runLoop,AFNewWork做法如下:
- (NSThread *)networkRequestThread { 
 static NSThread *_networkRequestThread = nil;
 static dispatch_once_t oncePredicate;
 dispatch_once(&oncePredicate, ^{
 _networkRequestThread = [[NSThread alloc] initWithTarget:self selector:@selector(networkRequestThreadEntryPoint:) object:nil];
 [_networkRequestThread start];
 });
 return _networkRequestThread;
 }
- (void)networkRequestThreadEntryPoint:(id)__unused object { 
 @autoreleasepool {
 [[NSThread currentThread] setName:@"AFNetworking"];
 NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
 [runLoop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];
 [runLoop run];
 }
 }
weak原理
key value是啥
答案:key 内存地址  value 指向weak指针的指针数组
propety 关键字
- 关键字有哪些 
 nullable, nonatomic,weak,readonly
 eg.@property(nullable,nonatomic,weak,readonly)
- iOS9的几个新关键字(nonnull、nullable、null_resettable、__null_unspecified) 
- copy解释 
 VC1 、VC2 , VC2拷贝VC1的属性,VC2修改值之后,VC1中的内容也跟着改变
- 深浅拷贝问题: 
 1、数组中 add 的对象 需要遵循nscopy协议么
 答案:不需要 深浅拷贝决定仅仅针对容器本身
 2、 nsarray copy mutableCopy之后 复制对象里的元素么
 答案:没有
 3、 nsstring nsmutablestring copy mutableCopy之后生成的对象?
 答案:不可变 copy浅拷贝 mutableCopy 深拷贝
 可变 copy深拷贝 mutableCopy深拷贝

测试代码:
 Student *stu1 = [[Student alloc] init];
    Student *stu2 = [[Student alloc] init];
    Student *stu3 = [[Student alloc] init];
    
    NSString *String = [NSString stringWithFormat:@"huaha"];
    NSString *strCopy = String.copy;
    NSString *strMutCopy = String.mutableCopy;
    
    NSString *mutstrCopy = strMutCopy.copy;
    NSString *mutstrmutCopy = strMutCopy.mutableCopy;
    
    NSLog(@"1:%p,2:%p,3:%p,4:%p",String,strCopy,strMutCopy,mutstrmutCopy);
    NSLog(@"1:%p,2:%p,3:%p,4:%p",&String,&strCopy,&strMutCopy,&mutstrmutCopy);
    
    
    NSArray *array = @[stu1,String,stu3];
    NSMutableArray *mutArr = array.copy;
    
    NSMutableArray *mutArr2 = mutArr.copy;
    
    Student *stuCopy1 = [mutArr objectAtIndex:0];
    Student *stuCopy2 = [mutArr objectAtIndex:1];
    Student *stuCopy3 = [mutArr objectAtIndex:2];
    NSLog(@"stu1:%@\n stuCopy1:%@",stu1,stuCopy1);
参考链接:
基于runloop的线程保活、销毁与通信   https://www.jianshu.com/p/4d5b6fc33519
面试题讨论: https://www.jianshu.com/p/f87f40592023
深浅拷贝: