0
請給我建議,我該如何解決解決這個問題.. NSSortDescriptor
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Weight" ascending:NO selector:@selector(localizedStandardCompare:)];
NSArray *sortedArray = [arrayToSort sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
我得到的輸出:
-[__NSCFNumber length]: unrecognized selector sent to instance 0x6a81cf0
2012-05-16 09:54:21.480 MedzioSearch[2188:f803] *** WebKit discarded an uncaught exception in the webView:shouldInsertText:replacingDOMRange:givenAction: delegate: <NSInvalidArgumentException> -[__NSCFNumber length]: unrecognized selector sent to instance 0x6a81cf0
感謝您的回覆。我正在使用@「Weight」作爲NSString.Please提供給我一個更好的NSString格式解決方案。 –
正如我所說的,我懷疑所有的「Weight」屬性都給出了「NSString」。試着把這段代碼放進去,看看它是什麼日誌:'NSLog(@「%@」,[arrayToSort valueForKeyPath:@「Weight.class」]);' –
Thanks Thomases,It work。 –