static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ //要执行的代码 }); 转载于:https://www.cnblogs.com/wangbaixue/p/5228246.html