{"action":"created","issue":{"url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/30","labels_url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/30/comments","events_url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/30/events","html_url":"https://github.com/ashare80/TSClusterMapView/issues/30","id":118832152,"number":30,"title":"negative span value results in crash","user":{"login":"aytunch","id":6442915,"avatar_url":"https://avatars.githubusercontent.com/u/6442915?v=3","gravatar_id":"","url":"https://api.github.com/users/aytunch","html_url":"https://github.com/aytunch","followers_url":"https://api.github.com/users/aytunch/followers","following_url":"https://api.github.com/users/aytunch/following{/other_user}","gists_url":"https://api.github.com/users/aytunch/gists{/gist_id}","starred_url":"https://api.github.com/users/aytunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aytunch/subscriptions","organizations_url":"https://api.github.com/users/aytunch/orgs","repos_url":"https://api.github.com/users/aytunch/repos","events_url":"https://api.github.com/users/aytunch/events{/privacy}","received_events_url":"https://api.github.com/users/aytunch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-25T13:02:13Z","updated_at":"2015-12-11T01:18:53Z","closed_at":null,"body":"Crash Report:\r\nInside \"TSClusterMapView.m\": \r\n\r\n    - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {\r\n        ....\r\n        if (MKMapRectSizeIsGreaterThanOrEqual(zoomTo, self.visibleMapRect)) {\r\n            zoomTo = MKMapRectInset(zoomTo, zoomTo.size.width/4, zoomTo.size.width/4);\r\n            //At this point zoomTo.size.height becomes negative\r\n        }\r\n        MKCoordinateRegion region = MKCoordinateRegionForMapRect(zoomTo); \r\n        //and negative zoomTo results in negative(invalid) region.span.latitudeDelta\r\n        ....\r\n        [self setRegion:region animated:YES];  \r\n        //Which results in a crash in this line with the invalid region being set\r\n    }\r\n`*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Region <center:+40.97086950, +29.03882550 span:-0.00556946, +0.01978016>'\r\n***`\r\n![img_4418](https://cloud.githubusercontent.com/assets/6442915/11397665/c8fdd592-9383-11e5-922e-096fec296147.PNG)\r\n\r\nScenario:\r\nQ:What makes `(MKMapRectSizeIsGreaterThanOrEqual(zoomTo, self.visibleMapRect))` equal to `YES`?\r\nA:In my particular case for some clusters(not leafs), when I touch on them the map starts zooming towards the center of the `clusterAnnotationView` which is good and expected. But for some reason, animation stops early and does not split the cluster that is selected. When the setRegion animation stops, I touch on the same cluster again and `MKMapRectSizeIsGreaterThanOrEqual` returns yes and I get the crash.\r\n![img_4419](https://cloud.githubusercontent.com/assets/6442915/11397674/dafe6fea-9383-11e5-8a2c-fb0ca37f3135.PNG)\r\n\r\nConclusion:\r\nI can fork the project and make sure the region values are valid before fed into setRegion:Animated: but this is not the real issue. I want to know why the cluster does not get broken when touched on it and stops early and how to avoid this."},"comment":{"url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/comments/163802300","html_url":"https://github.com/ashare80/TSClusterMapView/issues/30#issuecomment-163802300","issue_url":"https://api.github.com/repos/ashare80/TSClusterMapView/issues/30","id":163802300,"user":{"login":"ashare80","id":5692739,"avatar_url":"https://avatars.githubusercontent.com/u/5692739?v=3","gravatar_id":"","url":"https://api.github.com/users/ashare80","html_url":"https://github.com/ashare80","followers_url":"https://api.github.com/users/ashare80/followers","following_url":"https://api.github.com/users/ashare80/following{/other_user}","gists_url":"https://api.github.com/users/ashare80/gists{/gist_id}","starred_url":"https://api.github.com/users/ashare80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashare80/subscriptions","organizations_url":"https://api.github.com/users/ashare80/orgs","repos_url":"https://api.github.com/users/ashare80/repos","events_url":"https://api.github.com/users/ashare80/events{/privacy}","received_events_url":"https://api.github.com/users/ashare80/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T01:18:53Z","updated_at":"2015-12-11T01:18:53Z","body":"@aytunch Ok I'll check it out.\r\n\r\nIn your images are those annotation views or call outs?  \r\n\r\nIf they are annotation views the size may cause some problems with splitting since the algorithm takes into account the size of the views.  So if your leafs all appeared as the one with \"cookshop\" they probably wouldn't all be able to fit on the screen together and the cluster will never split.  That can be overcome by changing the mapView's \"clusterAnnotationViewSize\" but you'll end up with overlapping views."}}