如何在 objective-C 块中使用单例对象

How to use singleton object into a objective-C Block

 Using a singleton object in a block will create a strong reference cycle in the code ?

因为我在应用程序中有超过 5 个单例对象。

你必须在块中使用单例的弱引用。

YourSingleton *singletonInstance = ---- //get your singleton instance here

typeof(YourSingleton) __weak weakSingletonInstance = singletonInstance;

// your block
^
{
   // Now use weakSingletonInstance inside the block.           
}];