While I was building an app based on region monitoring, I find CLRegion only have one attribute which is .identifier, I need another NSString type attribute to modify the region so I create a class:

#import <CoreLocation/CoreLocation.h>

@interface CLCircularRegionObject : CLCircularRegion

@property NSString *soundIdentifier;
@end

In the region setting class I create a new class and pass the settled region and add extra attribute, the problem is regionWithSound is not recognised as a subclass of clcircluar region.

CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:self.annotationView.annotation.coordinate radius:self.radius identifier:self.mySearch.text];

CLCircularRegionObject *regionWithSound;
    if ([regionWithSound isKindOfClass:[CLCircularRegion class]]) {
        regionWithSound = region;
        regionWithSound.SoundIdentifier = self.AlarmSound;
    }

Related posts

Recent Viewed