iOS - [Class classMethod] results in unrecognized selector sent
<p>Due to code privacy, I have to omit part of info. Just excuse me.</p>

<p><a href="https://i.stack.imgur.com/O6Hpy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O6Hpy.png" alt="enter image description here"></a></p>

<p>In <code>TokenRequestManager.m</code>, there is an instance method <code>serialQueue4TokenType</code>:</p>

<pre><code>- (dispatch_queue_t)serialQueue4TokenType:(TokenType)tokenType
{
    static NSMutableDictionary *serialQueueDict = nil;
    if (serialQueueDict == nil) {
        static dispatch_once_t onceToken;
        dispatch_once(&amp;onceToken, ^{
            serialQueueDict = [[NSMutableDictionary alloc] initWithCapacity:TokenTypeCount];
        });
    }

    dispatch_queue_t queue;

    @synchronized (self) {
        NSString *key = [TokenManager tokenName4Type:tokenType];
        key = [key stringByAppendingString:NSStringFromClass([self class])];
        NSValue *value = serialQueueDict[key];

        if (value == nil) {
            queue = dispatch_queue_create(key.UTF8String, DISPATCH_QUEUE_SERIAL);
            value = [NSValue valueWithBytes:&amp;queue objCType:@encode(dispatch_queue_t)];
            serialQueueDict[key] = value;
        } else {
            [value getValue:&amp;queue];
        }
    }

    return queue;
}
</code></pre>

<p>Just below the <code>@synchronized (self) {</code> line, it calls the Class method:</p>

<pre><code>+ (NSString *)tokenName4Type:(TokenType)tokenType
{
    NSString *string = nil;

    switch (tokenType) {
        case TokenTypeBiz:
            return @"TokenTypeBiz";
            break;

        case TokenTypeWeb:
        default:
            string = @"TokenTypeWeb";
            break;
    }

    return string;
}
</code></pre>

<p>The code just stands there, but sometimes (a few times) the app will crash at this line with <code>unrecognized selector sent</code>, no matter debug or release.</p>

<p>Any tips will be much appreciated. Thanks.</p>