Is is a bug of iOS 15 itself?
What can I do to fix this?
It crashs when [UIPrintPreviewViewController reloadVisibleItems]
It only happends on iOS from 15.0.0 to 15.5.0 so far
When will UIPrintPreviewViewController reloadVisibleItems ?
We can't even reproduce the crash, but we get lots crash reports on Firebase.
Source code
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
if (controller) {
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.duplex = UIPrintInfoDuplexLongEdge;
controller.printInfo = printInfo;
controller.printingItems = [self dataList];
LYWeakifySelf;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *controller, BOOL completed, NSError *error) {
};
[controller presentAnimated:YES completionHandler:completionHandler];
}
- (NSArray<NSData *> *)dataList {
NSMutableArray *dataList = [NSMutableArray array];
[self enumerateDataUsingBlock:^(NSData *data, NSString *fileName) {
[dataList addObject:data];
}];
return dataList;
}
Crash info on Firebase
Fatal Exception: NSInternalInconsistencyException.
attempt to delete item 1 from section 0 which only contains 0 items before the update.
Stack trace
0 CoreFoundation __exceptionPreprocess
1 libobjc.A.dylib objc_exception_throw
2 Foundation _userInfoForFileAndLine
3 UIKitCore -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:]
4 UIKitCore -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:]
5 UIKitCore -[UICollectionView reloadItemsAtIndexPaths:]
6 UIKitCore -[UIPrintPreviewViewController reloadVisibleItems:]
7 UIKitCore __58-[UIPrintPreviewViewController updateLayoutWithPdfUpdate:]_block_invoke_2
8 Foundation __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
9 Foundation -[NSBlockOperation main]
10 Foundation __NSOPERATION_IS_INVOKING_MAIN__
11 Foundation -[NSOperation start]
12 Foundation __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__
13 Foundation __NSOQSchedule_f
14 libdispatch.dylib _dispatch_block_async_invoke2
15 libdispatch.dylib _dispatch_client_callout
16 libdispatch.dylib _dispatch_main_queue_drain
17 libdispatch.dylib _dispatch_main_queue_callback_4CF
18 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
19 CoreFoundation __CFRunLoopRun
20 CoreFoundation CFRunLoopRunSpecific
21 GraphicsServices GSEventRunModal
22 UIKitCore -[UIApplication _run]
23 UIKitCore UIApplicationMain
24 EverLens main.m - Line 14
main + 14
Related
Description
This is a crash that occurs within seconds of a user opening the app.
This crash occurs randomly, it is not reproducible.
This crash occurs in one place only, in the method that queries all of the user's posts
I have multiple methods that are structured similarly to this method that query different sets of data and the crash does not occur in those methods.
I have checked the data being queried and it is perfectly ok.
It appears that the crash occurs when the FIRDocumentSnapshot's data is trying to be used. (doc.data)
The try, catch block surrounding the method does not prevent the crash.
I am all out of ideas of what to do.
Crashed: com.apple.main-thread
0 FirebaseFirestore 0x905a4 -[FSTUserDataWriter convertedValue:] + 268
1 FirebaseFirestore 0x906cc -[FSTUserDataWriter convertedObject:] + 120
2 FirebaseFirestore 0x90610 -[FSTUserDataWriter convertedValue:] + 376
3 FirebaseFirestore 0x5865c -[FIRDocumentSnapshot dataWithServerTimestampBehavior:] + 200
4 FirebaseFirestore 0x58b14 -[FIRQueryDocumentSnapshot dataWithServerTimestampBehavior:] + 44
5 FirebaseFirestore 0x58a70 -[FIRQueryDocumentSnapshot data] + 44
6 WeDivvy 0x1189c __125-[GetDataObject GetDataGetItemsInSpecificHome:collection:keyArray:currentViewController:crashlyticsString:completionHandler:]_block_invoke + 1408 (GetDataObject.m:1408)
7 FirebaseFirestore 0x87db0 -[FIRQuery wrapQuerySnapshotBlock:]::Converter::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::api::QuerySnapshot>) + 128
8 FirebaseFirestore 0x11ce0c firebase::firestore::api::Query::GetDocuments(firebase::firestore::api::Source, std::__1::unique_ptr<firebase::firestore::core::EventListener<firebase::firestore::api::QuerySnapshot>, std::__1::default_delete<firebase::firestore::core::EventListener<firebase::firestore::api::QuerySnapshot> > >&&)::ListenOnce::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::api::QuerySnapshot>) + 352
9 FirebaseFirestore 0x11d3b8 firebase::firestore::api::Query::AddSnapshotListener(firebase::firestore::core::ListenOptions, std::__1::unique_ptr<firebase::firestore::core::EventListener<firebase::firestore::api::QuerySnapshot>, std::__1::default_delete<firebase::firestore::core::EventListener<firebase::firestore::api::QuerySnapshot> > >&&)::Converter::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>) + 756
10 FirebaseFirestore 0x3d15c void std::__1::__invoke_void_return_wrapper<void, true>::__call<firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&>(firebase::firestore::core::AsyncEventListener<firebase::firestore::core::ViewSnapshot>::OnEvent(firebase::firestore::util::StatusOr<firebase::firestore::core::ViewSnapshot>)::'lambda'()&) + 104
11 FirebaseFirestore 0x151604 firebase::firestore::util::Task::ExecuteAndRelease() + 184
12 libdispatch.dylib 0x647c8 _dispatch_client_callout + 16
13 libdispatch.dylib 0x45f18 _dispatch_main_queue_drain + 888
14 libdispatch.dylib 0x45b90 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 36
15 CoreFoundation 0x93848 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
16 CoreFoundation 0x774d4 __CFRunLoopRun + 2096
17 CoreFoundation 0x7bb7c CFRunLoopRunSpecific + 584
18 GraphicsServices 0x1984 GSEventRunModal + 160
19 UIKitCore 0x3753c8 -[UIApplication _run] + 868
20 UIKitCore 0x375040 UIApplicationMain + 312
21 WeDivvy 0x1af38 main + 18 (main.m:18) 22 ??? 0x1d7bc4df0 (Missing)
x
-(void)GetDataGetItemsInSpecificHome:(NSString *)homeID collection:(NSString *)collection keyArray:(NSArray *)keyArray currentViewController:(UIViewController *)currentViewController crashlyticsString:(NSString *)crashlyticsString completionHandler:(void (^)(BOOL finished, NSMutableDictionary *returningDataDict))finishBlock {
#try {
[[FIRCrashlytics crashlytics] logWithFormat:#"GetDataGetItemsInSpecificHome %# Processing(1)", collection];
__block NSMutableDictionary *dataDict = [NSMutableDictionary dictionary];
FIRFirestore *defaultFirestore = [FIRFirestore firestore];
[[[defaultFirestore collectionWithPath:collection] queryWhereField:#"ItemHomeID" isEqualTo:homeID] getDocumentsWithCompletion:^(FIRQuerySnapshot * _Nullable snapshot, NSError * _Nullable error) {
[[FIRCrashlytics crashlytics] logWithFormat:#"GetDataGetItemsInSpecificHome %# Processing(2)", collection];
for (FIRDocumentSnapshot *doc in snapshot.documents) {
[[FIRCrashlytics crashlytics] logWithFormat:#"GetDataGetItemsInSpecificHome Processing(3)"];
for (NSString *key in keyArray) {
[[FIRCrashlytics crashlytics] logWithFormat:#"GetDataGetItemsInSpecificHome:%# key:%# Processing(4)", crashlyticsString, key];
NSMutableArray *arr = dataDict[key] ? [dataDict[key] mutableCopy] : [NSMutableArray array];
******************************CRASH OCCURS HERE**********************************
NSDictionary *docData = doc.data ? doc.data : [Dictionary dictionary];
******************************CRASH OCCURS HERE**********************************
id object = doc.data[key] ? doc.data[key] : [[[GeneralObject alloc] init] GenerateDefaultValueBasedOnKey:key]; [arr addObject:object]; [dataDict setObject:arr forKey:key];
}
}
finishBlock(YES, dataDict);
} #catch (NSException *exception) {
finishBlock(YES, [NSMutableDictionary dictionary]);
}
}
I'm looking into a somewhat frequent crash reported in my application's Crashlytics console.
One of the many examples I have has the following crashed thread stacktrace:
#11. Crashed: com.apple.root.default-qos
0 libobjc.A.dylib 0x22f3fa86 objc_msgSend + 5
1 Foundation 0x23ee3005 -[NSString caseInsensitiveCompare:] + 28
2 Foundation 0x23ed10bd _NSCompareObject + 28
3 Foundation 0x23ed109d _NSSortFunctionOne + 120
4 CoreFoundation 0x2373e6a3 __CFSimpleMergeSort + 114
5 CoreFoundation 0x2373e6c5 __CFSimpleMergeSort + 148
6 CoreFoundation 0x2373e6d9 __CFSimpleMergeSort + 168
7 CoreFoundation 0x2373e6c5 __CFSimpleMergeSort + 148
8 CoreFoundation 0x2373e6d9 __CFSimpleMergeSort + 168
9 CoreFoundation 0x2368ac35 CFSortIndexes + 404
10 CoreFoundation 0x2368c241 CFMergeSortArray + 176
11 Foundation 0x23ed0a9d _sortedObjectsUsingDescriptors + 456
12 Foundation 0x23f9c9fb -[NSSet(NSKeyValueSorting) sortedArrayUsingDescriptors:] + 510
13 MyApp 0x6d431 __24-[MyApp refresh]_block_invoke (MyApp.m:247)
14 CoreFoundation 0x23769499 __NSArrayEnumerate + 372
15 CoreFoundation 0x236e6c3b -[NSArray enumerateObjectsWithOptions:usingBlock:] + 62
16 MyApp 0x6d17d -[MyApp refresh] (MyApp.m:263)
17 MyApp 0xa97eb __52-[MyAppRequest updateAfterNotification:]_block_invoke (MyAppRequest.m:1175)
18 libdispatch.dylib 0x23307cbf _dispatch_call_block_and_release + 10
19 libdispatch.dylib 0x233136a1 _dispatch_root_queue_drain + 1572
20 libdispatch.dylib 0x2331307b _dispatch_worker_thread3 + 94
21 libsystem_pthread.dylib 0x234a6e0d _pthread_wqthread + 1024
22 libsystem_pthread.dylib 0x234a69fc start_wqthread + 8
Other instances of the crash occur in the same app code (in the refresh method of MyApp class), but during different parts of the CoreFoundation sortedArrayUsingDescriptors method logic. For example, another crash example stacktrace has:
0 libobjc.A.dylib 0x1823cdb90 objc_msgSend + 16
1 CoreFoundation 0x182c42738 CFStringCompareWithOptionsAndLocale + 232
2 Foundation 0x183644840 _NSCompareObject + 64
3 CoreFoundation 0x182d150f4 __CFSimpleMergeSort + 196
4 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
5 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
6 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
7 CoreFoundation 0x182d1513c __CFSimpleMergeSort + 268
8 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
9 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
10 CoreFoundation 0x182d15124 __CFSimpleMergeSort + 244
11 CoreFoundation 0x182c3b738 CFSortIndexes + 472
12 CoreFoundation 0x182c3cf58 CFMergeSortArray + 220
13 Foundation 0x1836440f8 _sortedObjectsUsingDescriptors + 564
14 Foundation 0x183725120 -[NSSet(NSKeyValueSorting) sortedArrayUsingDescriptors:] + 564
15 MyApp 0x10006f264 __24-[MyApp refresh]_block_invoke (MyApp.m:247)
The app code in refresh is:
- (void)refresh {
NSArray *products = [self getProducts];
NSMutableArray *validProducts = [NSMutableArray array];
[products enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
Product *prod = obj;
// Convert to internal native format (MyAppProduct) for business reasons...
MyAppProduct *myAppProd = [[MyAppProduct alloc] init];
myAppProd.ID = prod.id;
myAppProd.name = prod.name;
NSArray *subProds = [prod.subProds sortedArrayUsingDescriptors:#[[NSSortDescriptor sortDescriptorWithKey:#"subProds" ascending:NO]]];
NSMutableArray *validSubProds = [NSMutableArray array];
[subProds enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
SubProd *subProd = obj;
// Convert to internal native format (MyAppSubProduct) for business reasons...
MyAppSubProduct *myAppSubProd = [[MyAppSubProduct alloc] initWithSubProd:subProd];
[validSubProds addObject:myAppSubProd];
}];
myAppProd.subProds = validSubProds;
myAppProd.count = [product.count integerValue];
// Add to array
[validProducts addObject:myAppProd];
}];
// Apply array to self
_products = validProducts
}
where getProducts is:
- (NSArray*)getProducts {
NSFetchRequest *productFetchRequest = [NSFetchRequest fetchRequestWithEntityName:#"Products"];
// Filter
NSMutableArray *productsPredicates = [NSMutableArray array];
[productsPredicates addObject:[NSPredicate predicateWithFormat:#"life_uid == %#", req.lifeUid]];
[productsPredicates addObject:[NSPredicate predicateWithFormat:#"hidden == %#", #NO]];
[productFetchRequest setPredicate:[NSCompoundPredicate andPredicateWithSubpredicates:productsPredicates]];
// Sort
NSSortDescriptor *sortProductsByName = [NSSortDescriptor sortDescriptorWithKey:#"name" ascending:YES];
[productFetchRequest setSortDescriptors:#[sortProductsByName]];
[productFetchRequest setReturnsObjectsAsFaults:NO];
[productFetchRequest setRelationshipKeyPathsForPrefetching:#[#"subprods", #"subprods.special"]];
NSManagedObjectContext *moc = [MyAppCoreDataController sharedController].mainManagedObjectContext;
NSError *error = nil;
NSArray *products = [moc executeFetchRequest:productFetchRequest error:&error];
if (error) {
NSLog(#"Error fetching products %#", error);
}
return products;
}
And refresh is being called like so:
- (void)updateAfterNotification:(NSNotification *)notification {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[MyApp instance] refresh];
});
}
Most likely it's because you're not handling Core Data concurrency correctly. When you create a managed object context using NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType, you must put all Core Data access inside a call to performBlock or performBlockAndWait. That includes fetches as well as accessing attribute values of fetched objects.
You're using dispatch_async, which is not the right way to handle concurrency with Core Data. You should switch to using performBlock or performBlockAndWait.
Usually app works great, but i received issue in Crashlytics. It's happen 1-2 times in week. For 2k-3k users. App work on iOS 7 and later.
Report: Fatal Exception: NSInvalidArgumentException
-[UIPasteboard setString:]: Argument is not an object of type NSString [(null)]
Here stack of thread where app crashed:
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x38fae1f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x390167b7 pthread_kill + 58
2 libsystem_c.dylib 0x38f5eff9 abort + 76
3 libc++abi.dylib 0x383ad98f abort_message + 74
4 libc++abi.dylib 0x383c66e7 default_terminate_handler() + 254
5 libobjc.A.dylib 0x389f9f7d _objc_terminate() + 192
6 APPNAME 0x001f1495 CPPExceptionTerminate() (KSCrashSentry_CPPException.mm:193)
7 libc++abi.dylib 0x383c41b3 std::__terminate(void (*)()) + 78
8 libc++abi.dylib 0x383c3a09 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
9 libobjc.A.dylib 0x389f9dbb objc_exception_throw + 250
10 CoreFoundation 0x2e25ee0d -[NSException initWithCoder:]
11 UIKit 0x30e3e0eb -[UIPasteboard(UIPasteboardDataExtensions) setString:] + 154
12 APPNAME 0x0011cfaf __33-[WebViewController moreActions:]_block_invoke_2 (WebViewController.m:424)
13 UIKit 0x30c74ceb __56-[UIActivityViewController _cleanupActivityWithSuccess:]_block_invoke + 54
14 UIKit 0x30ba87c9 -[UIWindowController transitionViewDidComplete:fromView:toView:removeFromView:] + 1880
15 UIKit 0x30ba7f9f __101-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke293 + 170
16 UIKit 0x30ba7ecb -[_UIViewControllerTransitionContext completeTransition:] + 74
17 UIKit 0x30ba7db1 -[UITransitionView notifyDidCompleteTransition:] + 288
18 UIKit 0x30ba78c1 -[UITransitionView _didCompleteTransition:] + 944
19 UIKit 0x30ac83b7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
20 UIKit 0x30ac82cf -[UIViewAnimationState animationDidStop:finished:] + 66
21 QuartzCore 0x30712e0b CA::Layer::run_animation_callbacks(void*) + 234
22 libdispatch.dylib 0x38ee2d3f _dispatch_client_callout + 22
23 libdispatch.dylib 0x38ee56c3 _dispatch_main_queue_callback_4CF + 278
24 CoreFoundation 0x2e229641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
25 CoreFoundation 0x2e227f0d __CFRunLoopRun + 1308
26 CoreFoundation 0x2e192729 CFRunLoopRunSpecific + 524
27 CoreFoundation 0x2e19250b CFRunLoopRunInMode + 106
28 GraphicsServices 0x331016d3 GSEventRunModal + 138
29 UIKit 0x30af3871 UIApplicationMain + 1136
30 APPNAME 0x000b9287 main (main.m:16)
App crahed in WebViewController in function moreActions.
12 APPNAME 0x0011cfaf __33-[WebViewController moreActions:]_block_invoke_2 (WebViewController.m:424)
This Function show UIActivityViewController and one of custom action - copy link to web page.
__weak WebViewController *weakSelf = self;
[activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed) {
WebViewController *strongSelf = weakSelf;
if ([activityType isEqualToString:#"VK"]) {
// actions
} else if ([activityType isEqualToString:#"copyLink"]) {
// HERE UIPasteboard!
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:[strongSelf.startUrl absoluteString]];
}
}];
Make sure that [strongSelf.startUrl absoluteString] does not returns nil just before setting it to pasteboard string. I'm pretty sure that your startUrl apparently becomes nil.
[self.kvoController observe:user keyPath: #"fullName" options:NSKeyValueObservingOptionNew block:^(id observer, id object, NSDictionary *change) {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *fullname = [change objectForKey:NSKeyValueChangeNewKey];
if ([fullname isKindOfClass:[NSString class]]) {
if (![weakSelf.fullnameLabel.text isEqualToString: fullname]) {
weakSelf.fullnameLabel.text = fullname;
[weakSelf.fullnameLabel sizeToFit];
}
}
});
}];
This code crashes on the 3rd line NSString *fullname = [change objectForKey:NSKeyValueChangeNewKey];
The crash log is as below:
Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00002069
0 libobjc.A.dylib 0x38449612 objc_retain + 17
1 Retro 0x0013336b __33-[ProfileHeaderView observeUser:]_block_invoke_2491 (ProfileHeaderView.m:598)
2 libdispatch.dylib 0x38922833 _dispatch_call_block_and_release + 10
3 libdispatch.dylib 0x3892281f _dispatch_client_callout + 22
4 libdispatch.dylib 0x3892949f _dispatch_main_queue_callback_4CF$VARIANT$mp + 278
5 CoreFoundation 0x2d83b8f1 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
6 CoreFoundation 0x2d83a1c5 __CFRunLoopRun + 1300
7 CoreFoundation 0x2d7a4f0f CFRunLoopRunSpecific + 522
8 CoreFoundation 0x2d7a4cf3 CFRunLoopRunInMode + 106
9 GraphicsServices 0x326ca663 GSEventRunModal + 138
10 UIKit 0x300f016d UIApplicationMain + 1136
11 Retro 0x0007d253 main (main.m:16)
Any idea why it crashed because I can't replicate this on my device (the log is from crash reporter).
I am getting this crash showing up in BugSense:
-[NSConcreteData count]: unrecognized selector sent to instance 0x14e57f10 - NSInvalidArgumentException
in this code:
+ (NSMutableArray *)applyFilters:(NSMutableArray *)theItems fromFilter:(NSDictionary *)filters
{
NSMutableArray *items = [[NSMutableArray alloc] initWithArray:theItems];
if ([[filters allKeys] count] > 0)
{
NSMutableArray *tempFilteredItems = [[NSMutableArray alloc] init];
for (NSString *key in [filters allKeys])
{
NSMutableString *convertedKey = [NSMutableString stringWithString:key];
[convertedKey replaceOccurrencesOfString:#" "
withString:#"_"
options:NSCaseInsensitiveSearch
range:NSMakeRange(0, [convertedKey length])];
NSArray *tempFilterAttributes = [NSArray arrayWithArray:filters[key]];
for (NSDictionary *item in items)
{
if (![[item[convertedKey] componentsSeparatedByString:#"*"] firstObjectCommonWithArray:tempFilterAttributes])
{
if (![tempFilteredItems containsObject:item])
{
[tempFilteredItems addObject:item];
}
}
}
[items removeObjectsInArray:tempFilteredItems];
[tempFilteredItems removeAllObjects];
}
}
return items;
}
Why/how is this happening?
Stack trace is:
CoreFoundation <redacted> + 130
1 libobjc.A.dylib objc_exception_throw + 38
2 CoreFoundation <redacted> + 202
3 CoreFoundation <redacted> + 706
4 CoreFoundation _CF_forwarding_prep_0 + 24
5 CoreFoundation <redacted> + 28
6 Video Games +[Helper applyFilters:fromFilter:] (Helper.m:2862)
7 Video Games -[WishlistViewController loadUp] (WishlistViewController.m:409) + 29303
8 Video Games -[WishlistViewController viewWillAppear:] (WishlistViewController.m:363) + 27955
9 UIKit <redacted> + 374
10 UIKit <redacted> + 612
11 UIKit <redacted> + 572
12 UIKit <redacted> + 44
13 UIKit <redacted> + 184
14 UIKit <redacted> + 380
15 QuartzCore <redacted> + 142
16 QuartzCore <redacted> + 350
17 QuartzCore <redacted> + 16
18 QuartzCore <redacted> + 228
19 QuartzCore <redacted> + 314
20 UIKit <redacted> + 126
21 CoreFoundation <redacted> + 20
22 CoreFoundation <redacted> + 286
23 CoreFoundation <redacted> + 738
24 CoreFoundation CFRunLoopRunSpecific + 524
25 CoreFoundation CFRunLoopRunInMode + 106
26 GraphicsServices GSEventRunModal + 138
27 UIKit UIApplicationMain + 1136
28 Video Games main (main.m:16) + 888911
29 libdyld.dylib <redacted> + 2
The problem has nothing to do with the code that you provided. The error messages says that the message count was sent to the class NSConcreteData, which is essentially the same as NSData, and such a class method does not exist.
I suggest that you set an exception breakpoint (in Xcode select left the breakpoint navigator, click + left bottom, and select add exception breakpoint).
When you execute the app, it will stop at the faulty instruction.
EDIT (due to the stack trace you provided now):
The stack trace indeed says that your method applyFilters:fromFilter: is responsible for the crash. The only place where the message count is sent in this method, is the statement [[filters allKeys] count]. It looks then that count is sent to an NSConcreteData object, and not to an NSArray object as you might have expected. One reason could be that the argument filters, that should be a NSDictionary, is an object of a different type.
So when the app stops at the exception breakpoint, please check the class of the instance filters.