Crash at dispatch_once (& onceToken, ^ {

+(Service *) sharedInstance
{
    static LocationService *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{              <<<< Crash
        instance = [[self alloc]init];
    });
    return instance;
}

I am using the above code to create an instance of Singleton in my application. This is called from the AppDelegate: willFinishLaunchingWithOptions: application.

For most users, this code works fine. But for 2 users, the application crashes on "dispatch_once (& onceToken, ^ {" line.

They uninstalled the application and installed it again. But they still see the problem. Only these 2 users face this problem. Others have never seen this. I have .dsym, .crash and other related files for further debugging. Just wanted to know how to get started with this? If someone saw a similar problem, how did they fix it?

+4
1

self. self . .

+(Service *) sharedInstance
{
static LocationService *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{            
    instance = [[Service  alloc]init];
});
return instance;
}
0

All Articles