{"action":"created","issue":{"url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/9","labels_url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/9/comments","events_url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/9/events","html_url":"https://github.com/bazaarvoice/bv-ios-sdk/issues/9","id":81077180,"number":9,"title":"BVAnalytics and BVRisonEncoder crash","user":{"login":"toohotz","id":795804,"avatar_url":"https://avatars.githubusercontent.com/u/795804?v=3","gravatar_id":"","url":"https://api.github.com/users/toohotz","html_url":"https://github.com/toohotz","followers_url":"https://api.github.com/users/toohotz/followers","following_url":"https://api.github.com/users/toohotz/following{/other_user}","gists_url":"https://api.github.com/users/toohotz/gists{/gist_id}","starred_url":"https://api.github.com/users/toohotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toohotz/subscriptions","organizations_url":"https://api.github.com/users/toohotz/orgs","repos_url":"https://api.github.com/users/toohotz/repos","events_url":"https://api.github.com/users/toohotz/events{/privacy}","received_events_url":"https://api.github.com/users/toohotz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-26T18:20:00Z","updated_at":"2015-05-26T19:25:57Z","closed_at":null,"body":"Info:\r\n_Xcode 6.3.2 iOS Simulator 8.3 iOS device iPhone 6 iOS 8.1 & 8.3_\r\n\r\nWithin a project that I am working on, there is a crash occurring from within the **BVAnalytics.m** file where an ```NSMutableArray``` called **eventsArray** is trying to remove objects when it currently does not hold any.  How this particular crash is triggering is through the user review section within the app where scrolling through a long list of user reviews (paginating by each set of 10 reviews), triggers this crash.  This crash only triggers in the iOS simulator and has not been reproducible from a device. \r\n\r\nThere is a second crash that is occurring from within the ```BVRisonEncoder.m```where inside of another ```NSMutableArray```, the array is being mutated on while it is being enumerated through which is triggering a crash since mutation cannot occur whilst enumeration is happening.  This crash is triggered in the same way that the previous crash was by pulling in new user reviews (same 10 at a time) and displaying them on screen. This crash occurs both on the simulator and on device as well but is not as easily reproducible.\r\n\r\nAlso attached some screenshots of Xcode when this crash is triggered.\r\n\r\nhttps://www.dropbox.com/s/hdrpbbg6da8whdx/Screen%20Shot%202015-05-11%20at%202.16.16%20PM.png?dl=0\r\n\r\nhttps://www.dropbox.com/s/4l8dj32ahfyqrbe/Screen%20Shot%202015-05-26%20at%2012.47.48%20PM.png?dl=0\r\n\r\n(The long mass crash log for the ```BVRisonEncoder.m```)\r\n\r\n2015-05-26 12:38:59.988 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Discover \r\n\r\n2015-05-26 12:38:59.993 Cookie Van[91685:22075642] AppsFlyer SDK version 2.5.3.15.1 started\r\n2015-05-26 12:39:00.504 Cookie Van[91685:22075642] __27-[LPNetworkingManager init]_block_invoke [Line 40] Reachability: Reachable via WiFi\r\n2015-05-26 12:39:00.509 Cookie Van[91685:22075642] __27-[LPNetworkingManager init]_block_invoke [Line 40] Reachability: Reachable via WiFi\r\n2015-05-26 12:39:00.536 Cookie Van[91685:22075642] AppsFlyer dev key is missing\r\n2015-05-26 12:40:44.818 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Shop \r\n\r\n2015-05-26 12:40:54.785 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - User tapped on top category: \r\n--Category name: New Arrivals \r\n\r\n2015-05-26 12:40:54.815 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Shop - New Arrivals \r\n\r\n2015-05-26 12:40:56.690 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Shop \r\n\r\n2015-05-26 12:40:58.053 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Search \r\n\r\n2015-05-26 12:40:59.930 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Search - Results \r\n\r\n2015-05-26 12:41:01.440 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - User searched for a word: \r\n--Word: skipper popover \r\n\r\n2015-05-26 12:41:01.504 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: Search - Results - CDP \r\n\r\n2015-05-26 12:41:02.983 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: PDP \r\n\r\n2015-05-26 12:41:04.968 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Product Event: \r\n--Category Name: Search  \r\n--Product Name: Skipper Printed Popover \r\n--Price: 128 \r\n\r\n2015-05-26 12:41:04.988 Cookie Van[91685:22075642] the behavior of the UICollectionViewFlowLayout is not defined because:\r\n2015-05-26 12:41:04.988 Cookie Van[91685:22075642] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values.\r\n2015-05-26 12:41:07.412 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Product reviews viewed: \r\n--Product name: Skipper Printed Popover \r\n--Number of reviews: 10 \r\n--Style number: 33261 \r\n\r\n2015-05-26 12:41:07.414 Cookie Van[91685:22075642] +[LPMParticle showLogMessage:] [Line 42] \r\n\r\nLPMParticle - Screen Viewed: \r\n--Screen Name: PDP - Reviews \r\n\r\n2015-05-26 12:42:10.611 Cookie Van[91685:22084473] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x7be95a60> was mutated while being enumerated.'\r\n*** First throw call stack:\r\n(\r\n\t0   CoreFoundation                      0x05e18746 __exceptionPreprocess + 182\r\n\t1   libobjc.A.dylib                     0x05aa1a97 objc_exception_throw + 44\r\n\t2   CoreFoundation                      0x05e17fe6 __NSFastEnumerationMutationHandler + 166\r\n\t3   Cookie Van                          0x0026ce0f +[BVRisonEncoder formatArray:] + 367\r\n\t4   Cookie Van                          0x0026c4e3 +[BVRisonEncoder encode:] + 467\r\n\t5   Cookie Van                          0x0026025e -[BVAnalytics batchImpressionEvents:type:] + 110\r\n\t6   Cookie Van                          0x0025f02c -[BVAnalytics getBatchedEventsUrl:type:] + 108\r\n\t7   Cookie Van                          0x0025e711 __25-[BVAnalytics flushQueue]_block_invoke + 113\r\n\t8   libdispatch.dylib                   0x062d05ea _dispatch_call_block_and_release + 15\r\n\t9   libdispatch.dylib                   0x062f2bef _dispatch_client_callout + 14\r\n\t10  libdispatch.dylib                   0x062da1ef _dispatch_root_queue_drain + 1092\r\n\t11  libdispatch.dylib                   0x062dbb70 _dispatch_worker_thread3 + 115\r\n\t12  libsystem_pthread.dylib             0x066371da _pthread_wqthread + 724\r\n\t13  libsystem_pthread.dylib             0x06634e2e start_wqthread + 30\r\n)\r\n2015-05-26 12:42:10.614 Cookie Van[91685:22087011] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x7be95a60> was mutated while being enumerated.'\r\n*** First throw call stack:\r\n(\r\n\t0   CoreFoundation                      0x05e18746 __exceptionPreprocess + 182\r\n\t1   libobjc.A.dylib                     0x05aa1a97 objc_exception_throw + 44\r\n\t2   CoreFoundation                      0x05e17fe6 __NSFastEnumerationMutationHandler + 166\r\n\t3   Cookie Van                          0x0026ce0f +[BVRisonEncoder formatArray:] + 367\r\n\t4   Cookie Van                          0x0026c4e3 +[BVRisonEncoder encode:] + 467\r\n\t5   Cookie Van                          0x0026025e -[BVAnalytics batchImpressionEvents:type:] + 110\r\n\t6   Cookie Van                          0x0025f02c -[BVAnalytics getBatchedEventsUrl:type:] + 108\r\n\t7   Cookie Van                          0x0025e711 __25-[BVAnalytics flushQueue]_block_invoke + 113\r\n\t8   libdispatch.dylib                   0x062d05ea _dispatch_call_block_and_release + 15\r\n\t9   libdispatch.dylib                   0x062f2bef _dispatch_client_callout + 14\r\n\t10  libdispatch.dylib                   0x062da1ef _dispatch_root_queue_drain + 1092\r\n\t11  libdispatch.dylib                   0x062dbb70 _dispatch_worker_thread3 + 115\r\n\t12  libsystem_pthread.dylib             0x066371da _pthread_wqthread + 724\r\n\t13  libsystem_pthread.dylib             0x06634e2e start_wqthread + 30\r\n)\r\nlibc++abi.dylib: terminating with uncaught exception of type NSException\r\nlibc++abi.dylib: terminating with uncaught exception of type NSException\r\n(lldb) \r\n\r\nThank you,\r\nHotz\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/comments/105641397","html_url":"https://github.com/bazaarvoice/bv-ios-sdk/issues/9#issuecomment-105641397","issue_url":"https://api.github.com/repos/bazaarvoice/bv-ios-sdk/issues/9","id":105641397,"user":{"login":"JasonJasonJason","id":2281192,"avatar_url":"https://avatars.githubusercontent.com/u/2281192?v=3","gravatar_id":"","url":"https://api.github.com/users/JasonJasonJason","html_url":"https://github.com/JasonJasonJason","followers_url":"https://api.github.com/users/JasonJasonJason/followers","following_url":"https://api.github.com/users/JasonJasonJason/following{/other_user}","gists_url":"https://api.github.com/users/JasonJasonJason/gists{/gist_id}","starred_url":"https://api.github.com/users/JasonJasonJason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JasonJasonJason/subscriptions","organizations_url":"https://api.github.com/users/JasonJasonJason/orgs","repos_url":"https://api.github.com/users/JasonJasonJason/repos","events_url":"https://api.github.com/users/JasonJasonJason/events{/privacy}","received_events_url":"https://api.github.com/users/JasonJasonJason/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T19:25:57Z","updated_at":"2015-05-26T19:25:57Z","body":"Thanks for finding this, and the excellent issue write up!! :+1:\r\nI'll start working on this immediately and update this issue when fixed."}}