1

我在核心数据存储中有一个路径字符串,例如/folder/file.doc

我想创建一个谓词,它会用类似的表达式找到这个字符串/dir/dir2/folder/file.doc

但我不能只反转键路径和字符串,如:

[NSPredicate predicateWithFormat:@"%@ CONTAINS[c] path",
@"/dir/dir2/folder/file.doc"]

我不能写这样的东西:

[NSPredicate predicateWithFormat:@"*path LIKE[c] %@",
@"/dir/dir2/folder/file.doc"]

更新

添加了所有异常断点。结果是:

2012-11-05 22:10:28.316 SkyFolder[9723:c07] -[NSPathStore2 countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x8246670
2012-11-05 22:11:38.558 SkyFolder[9723:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x8246670'
*** First throw call stack:
(0x1e03012 0x1c28e7e 0x1e8e4bd 0x1df2bbc 0x1df294e 0x3f3afc 0x3f3296 0x3e5cb9 0x3e5198 0x3dfda5 0x3dfa82 0x3df850 0x3df625 0x3dee07 0x3de8f4 0x3dda6d 0x3db9c9 0x2e32 0xa152 0xc1f8d5 0xc1fb3d 0x1626e83 0x1dc2376 0x1dc1e06 0x1da9a82 0x1da8f44 0x1da8e1b 0x27747e3 0x2774668 0xb7065c 0x242d 0x2355)
libc++abi.dylib: terminate called throwing an exception

更新

堆栈跟踪:

Thread 1, Queue : com.apple.main-thread
#0  0x01c28e52 in objc_exception_throw ()
#1  0x01e8e4bd in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#2  0x01df2bbc in ___forwarding___ ()
#3  0x01df294e in _CF_forwarding_prep_0 ()
#4  0x003f3afc in -[NSSQLIntermediate _generateSQLForConstantCollection:inContext:] ()
#5  0x003f3296 in -[NSSQLSimpleWhereIntermediate _generateSQLContainmentStringInContext:] ()
#6  0x003e5cb9 in -[NSSQLSimpleWhereIntermediate generateSQLStringInContext:] ()
#7  0x003e5198 in -[NSSQLFetchIntermediate generateSQLStringInContext:] ()
#8  0x003dfda5 in -[NSSQLGenerator newSQLStatementForFetchRequest:ignoreInheritance:countOnly:nestingLevel:] ()
#9  0x003dfa82 in -[NSSQLAdapter _newSelectStatementWithFetchRequest:ignoreInheritance:] ()
#10 0x003df850 in -[NSSQLAdapter newSelectStatementWithFetchRequest:] ()
#11 0x003df625 in -[NSSQLCore newRowsForFetchPlan:] ()
#12 0x003dee07 in -[NSSQLCore objectsForFetchRequest:inContext:] ()
#13 0x003de8f4 in -[NSSQLCore executeRequest:withContext:error:] ()
#14 0x003dda6d in -[NSPersistentStoreCoordinator executeRequest:withContext:error:] ()
#15 0x003db9c9 in -[NSManagedObjectContext executeFetchRequest:error:] ()
#16 0x00002d92 in -[SFDocumentDetailViewController openFile:] at /Users/andrew_turkin/Documents/Developer/SkyFolder/SkyFolder/SFDocumentDetailViewController.m:78
#17 0x0000a152 in -[SFFileNavigationViewController tableView:didSelectRowAtIndexPath:] at /Users/andrew_turkin/Documents/Developer/SkyFolder/SkyFolder/SFFileNavigationViewController.m:295
#18 0x00c1f8d5 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] ()
#19 0x00c1fb3d in -[UITableView _userSelectRowAtPendingSelectionIndexPath:] ()
#20 0x01626e83 in __NSFireDelayedPerform ()
#21 0x01dc2376 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#22 0x01dc1e06 in __CFRunLoopDoTimer ()
#23 0x01da9a82 in __CFRunLoopRun ()
#24 0x01da8f44 in CFRunLoopRunSpecific ()
#25 0x01da8e1b in CFRunLoopRunInMode ()
#26 0x027747e3 in GSEventRunModal ()
#27 0x02774668 in GSEventRun ()
#28 0x00b7065c in UIApplicationMain ()
#29 0x0000238d in main at /Users/andrew_turkin/Documents/Developer/SkyFolder/SkyFolder/main.m:16
#30 0x000022b5 in start ()
Thread 2, Queue : (null)
Thread 3, Queue : com.apple.libdispatch-manager
Thread 4, Queue : (null)
Thread 5 WebThread, Queue : (null)
Thread 6 com.apple.NSURLConnectionLoader, Queue : (null)
Thread 7, Queue : (null)
Thread 8, Queue : (null)
Thread 9 com.apple.CFSocket.private, Queue : (null)
4

0 回答 0