This is perfectly fine. You can trigger a search and an alert view based on the search result triggered by a gesture, including a shake gesture.
Check what exactly your error is, so pass an error object to your countForFetchRequest
method. Possibly your managedObjectContext
is nil or you have some problem with your entity name. ("Groups" would be a bad name for an entity. "Group" is much more logical.)