Issue Information
-
#000103
-
Issue
Issue Confirmations
-
Yes (0)No (0)
1
Crash when using single-quote in the search bar attached to a SCArrayOfObjectsSection
Posted by
growingthefaith
on 10 February 2015 - 06:44 PM
I have a SCArrayOfObjectsSection with the following code for the UISearchBar:
//Define a custom model
SCDictionaryDefinition *familiesDefinition = [SCDictionaryDefinition definitionWithDictionaryKeyNamesString:@"FirstName;LastName;AddressCity;ContactPhone"];
familiesDefinition.titlePropertyName = @"lastName";
familiesDefinition.descriptionPropertyName = @"contactPhone";
SCArrayOfObjectsModel *familiesModel = [SCArrayOfObjectsModel modelWithTableView:self.tableView items:[[OPManager sharedOPManager] familiesArray] itemsDefinition:familiesDefinition];
familiesModel.searchBar = tableSearchBar;
familiesModel.searchPropertyName = @"lastName";
If I run the app and try to type a single quote mark " ' " into the search bar, the app crashes with this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "lastName contains[cd] '''"'
*** First throw call stack:
(
0 CoreFoundation 0x00000001105ccf35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110265bb7 objc_exception_throw + 45
2 Foundation 0x000000010dd293ed _qfqp2_performParsing + 8495
3 Foundation 0x000000010dd27256 +[NSPredicate predicateWithFormat:arguments:] + 46
4 Foundation 0x000000010dd27210 +[NSPredicate predicateWithFormat:] + 142
5 OneParish 0x000000010ad686e9 -[SCArrayOfObjectsModel searchBar:textDidChange:] + 1033
6 UIKit 0x000000010f17a374 -[UISearchBar(UISearchBarStatic) _searchFieldEditingChanged] + 99
7 UIKit 0x000000010ee8c8be -[UIApplication sendAction:to:from:forEvent:] + 75
...and so on.
If it helps, I think the issue can be solved with something similar to this:
http://stackoverflow...e-format-string
Thanks,
Ryan
//Define a custom model
SCDictionaryDefinition *familiesDefinition = [SCDictionaryDefinition definitionWithDictionaryKeyNamesString:@"FirstName;LastName;AddressCity;ContactPhone"];
familiesDefinition.titlePropertyName = @"lastName";
familiesDefinition.descriptionPropertyName = @"contactPhone";
SCArrayOfObjectsModel *familiesModel = [SCArrayOfObjectsModel modelWithTableView:self.tableView items:[[OPManager sharedOPManager] familiesArray] itemsDefinition:familiesDefinition];
familiesModel.searchBar = tableSearchBar;
familiesModel.searchPropertyName = @"lastName";
If I run the app and try to type a single quote mark " ' " into the search bar, the app crashes with this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "lastName contains[cd] '''"'
*** First throw call stack:
(
0 CoreFoundation 0x00000001105ccf35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110265bb7 objc_exception_throw + 45
2 Foundation 0x000000010dd293ed _qfqp2_performParsing + 8495
3 Foundation 0x000000010dd27256 +[NSPredicate predicateWithFormat:arguments:] + 46
4 Foundation 0x000000010dd27210 +[NSPredicate predicateWithFormat:] + 142
5 OneParish 0x000000010ad686e9 -[SCArrayOfObjectsModel searchBar:textDidChange:] + 1033
6 UIKit 0x000000010f17a374 -[UISearchBar(UISearchBarStatic) _searchFieldEditingChanged] + 99
7 UIKit 0x000000010ee8c8be -[UIApplication sendAction:to:from:forEvent:] + 75
...and so on.
If it helps, I think the issue can be solved with something similar to this:
http://stackoverflow...e-format-string
Thanks,
Ryan
0 user(s) are reading this issue
0 members, 0 guests, 0 anonymous users