一.单例模拟
1> Xcode报的错误(There can only be one UIApplication instance.)
原因:该对象是单例对象,内存中只会创建一次,会出这样的错误,肯定是你用单例的类alloc,init创建对象了,所以会报错.
2> 模拟Xcode获取单例对象不正确的时候会报的错误
3> 创建一个类如Person类
4> 在Person点m文件要写的代码如下:
1> Xcode报的错误(There can only be one UIApplication instance.)
原因:该对象是单例对象,内存中只会创建一次,会出这样的错误,肯定是你用单例的类alloc,init创建对象了,所以会报错.
2> 模拟Xcode获取单例对象不正确的时候会报的错误
3> 创建一个类如Person类
4> 在Person点m文件要写的代码如下: