GeoFence Demo Invalid Region help!

Hello
When I try to run the simulator I get this:

2017-01-21 19:04:02.813 GeoFenceDemo01[1127:40258] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Invalid Region <center:-180.00000000, -180.00000000 span:nan, nan>’
*** First throw call stack:
(
0 CoreFoundation 0x000000010a6dfd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a14121e objc_exception_throw + 48
2 CoreFoundation 0x000000010a6dfc99 -[NSException raise] + 9
3 MapKit 0x0000000109873ccc -[MKMapView setRegion:animated:] + 705
4 GeoFenceDemo01 0x00000001097bc98e -[ViewController viewDidLoad] + 1022
5 UIKit 0x000000010ad48a3d -[UIViewController loadViewIfRequired] + 1258
6 UIKit 0x000000010ad48e70 -[UIViewController view] + 27
7 UIKit 0x000000010ac124b5 -[UIWindow addRootViewControllerViewIfPossible] + 71
8 UIKit 0x000000010ac12c06 -[UIWindow _setHidden:forced:] + 293
9 UIKit 0x000000010ac26519 -[UIWindow makeKeyAndVisible] + 42
10 UIKit 0x000000010ab9ef8d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
11 UIKit 0x000000010aba50ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
12 UIKit 0x000000010aba226d -[UIApplication workspaceDidEndTransaction:] + 188
13 FrontBoardServices 0x0000000112cca6cb FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
14 FrontBoardServices 0x0000000112cca544 -[FBSSerialQueue _performNext] + 189
15 FrontBoardServices 0x0000000112cca8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
16 CoreFoundation 0x000000010a684761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
17 CoreFoundation 0x000000010a66998c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x000000010a668e76 __CFRunLoopRun + 918
19 CoreFoundation 0x000000010a668884 CFRunLoopRunSpecific + 420
20 UIKit 0x000000010aba0aea -[UIApplication _run] + 434
21 UIKit 0x000000010aba6c68 UIApplicationMain + 159
22 GeoFenceDemo01 0x00000001097bda1f main + 111
23 libdyld.dylib 0x0000000110ece68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Can someone help me please?

Probably you should post your definition of the region itself in XCode to help us help you. A stack trace like this above is hard to decipher unless you are very familiar with the product (therefore don’t need this class!)

Solved! Thanks anyway :relaxed:

1 Like

Hi Gerardo, I have the same issue.

How did u solve it?

Thanks,
Mircea

Never mind, I find the solution, I just initialized the struct with some value

CLLocationCoordinate2D noLocation = CLLocationCoordinate2DMake(0,0);

Cheers,
Mircea