herrtort/sss — pull request #1 by herrtort (2014-03-13 10:55:58+00:00)
Title: Bugfix

Bug#1
What was the root cause of the bug?
Attempt to dispatch_sync on main thread already being on main thread caused main thread to freeze.

How did you fix the problem?
Added check if current thread is main thread. If "yes" - call code block without dispatch_sync.

Bug#2
What was the root cause of the bug?
"x" variable was not marked as block variable. So it's value was just copied by the block in it's initial state and thus all other operations with "x" variable had not effect in block.

How did you fix the problem?
"x" variable marked as block variable.

Bug#3
What was the root cause of the bug?
Output filled by a standard description of coredata object.

How did you fix the problem?
Fixed by overriding "description" method with custom description.

Bug#4
What was the root cause of the bug?
"cleanData" method was called only after second call of method "fourthBug:".

How did you fix the problem?
Fixed by changing condition in if-statement to "count >= 1" (Not sure that this is a desirable solution :))

Bug#5
What was the root cause of the bug?
"executeFetchRequest:error:" returns unsorted array of entities.

How did you fix the problem?
Fixed by adding custom sort descriptors to NSFetchRequest object.