0

Not really understand what the exception is and there is no back trace for me to look into it.

- (CLCircularRegion *)regionWithGeotification:(Geotification *)geotification{
    NSLog(@"Set region with geotification");

*********
    CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:geotification.coordinate radius:geotification.radius identifier:geotification.identifier];
*********
    [region setNotifyOnEntry:geotification.eventType==OnEntry];
    [region setNotifyOnExit:!region.notifyOnEntry];

    NSLog(@"region notify on %d",region.notifyOnExit);
    NSLog(@"Done setting region");
    return region;
}

What I found out is the crashes start in code above.

2018-11-01 17:25:52.412643+0800 Loud Speaker[12276:1296047] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber getCString:maxLength:encoding:]: unrecognized selector sent to instance 0x85aec1991d2b50a2'
*** First throw call stack: (0x193ff7ef8 0x1931c5a40 0x193f0f154 0x193ffd810 0x193fff4bc 0x19aeb0904 0x19aeb1cbc 0x100d2b024
0x100d2b5ec 0x100d2a478 0x100d2a12c 0x100d29418 0x100d9986c
0x100d449b4 0x100de136c 0x102be7840 0x102be8de4 0x102bf6830
0x193f861bc 0x193f81084 0x193f805b8 0x1961f4584 0x1c0dfcbc8
0x100d93164 0x193a40b94) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
rmaddy
  • 314,917
  • 42
  • 532
  • 579
joey
  • 73
  • 2
  • 14
  • The error is pretty clear: The expected type is `NSString` but the passed type is `NSNumber` – vadian Nov 01 '18 at 09:58
  • I am quite new to ios. i still don't really understand what the log talking about. i will give a try and post an answer. – joey Nov 01 '18 at 10:11
  • @vadian can you post it as answer since you answered it. i will mark it as correct. i solved my problem. – joey Nov 01 '18 at 10:18
  • 2
    I didn't post an answer because it's unclear where exactly the error occurred. – vadian Nov 01 '18 at 10:24
  • What is `Geotification`? I guess that `geotification.identifier` is a Number and not a String. But how did you get it? – Larme Nov 01 '18 at 20:11
  • I suspect it comes from here: https://www.raywenderlich.com/966-geofencing-tutorial-with-core-location – bbum Nov 01 '18 at 20:32
  • Geotification is a class that i created for geofence. Its a number but CLCircularRegion needs an identifier in string. So i change it in String and it work. – joey Nov 02 '18 at 06:55

0 Answers0