外国网站:http://www.raywenderlich.com/42266/augmented-reality-ios-tutorial-location-based
看了下里面的demo,源代码里有个用gcd创建的实例;
于是就百度了下:dispatch_once_t 发现用它来创建单例很方便;
http://bj007.blog.51cto.com/1701577/649413/
+ (PlacesLoader *)sharedInstance {
static PlacesLoader *instance = nil;
staticdispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[PlacesLoader alloc] init];
});
return instance;
}