Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
541 views
in Technique[技术] by (71.8m points)

swift - locationManager didExitRegion never called for iBeaconRegion when monitor region

I've created region:

let uuid = UUID(uuidString: "04C7E2F3-42A5-5127-B066-502C8A27EB85")! 

beaconRegion = CLBeaconRegion(uuid: uuid, identifier: uuid.uuidString)

And using mbeacon from terminal created beacon from my MacBook.

Creating beacon with mbeacon: screenshot.

In the method didRangeBeacons this beacon is detected and when I go far from the beacon, proximity increased and then the beacon is disappeared, but didExitRegion never called. Where is the moment, when this method should be called? Maybe I understand something wrong.

question from:https://stackoverflow.com/questions/66050417/locationmanager-didexitregion-never-called-for-ibeaconregion-when-monitor-region

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I checked locationManager.monitoredRegions and saw unnecessary regions here. I stopped monitoring (func stopMonitoring(for region: CLRegion) or you can simply uninstall the app and install it again, as this will clear the monitoring list.) for unnecessary regions and didExitRegion and didEnterRegion now work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...