์ค์๊ฐ ์์น ์ ๋ฐ์ดํธ๋ฅผ ์ํด ์คํธ๋ฆผ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๊ณ ์๋๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์๋ฎฌ๋ ์ดํฐ์์ ๋ด ์์น๊ฐ ๊ณ ์ ๋๋ฉด ์ ๋ฐ์ดํธ๊ฐ ์ ์์ ์ผ๋ก ์๋ํ์ง๋ง ์์น๋ฅผ ์ด๋ (์๋ฎฌ๋ ์ดํฐ-> ๋๋ฒ๊ทธ-> ์์น-> ๋์ ์คํ)์ผ๋ก ์ค์ ํ๋ฉด ์์ธ๊ฐ ๋ฐ์ํฉ๋๋ค.
[VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
PlatformException(ERROR_UPDATING_LOCATION, The operation couldnโt be completed. (kCLErrorDomain error 0.), null)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1112:29)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
์์ธ๋ฅผ ๋ฐ์์ํค์ง ์๊ณ ์์น๊ฐ ์ ๋ฐ์ดํธ๋ฉ๋๋ค.
var locationOptions =
LocationOptions(accuracy: LocationAccuracy.high, distanceFilter: 10);
geolocator.getPositionStream(locationOptions).listen((Position position) {
print("New pos update: $position");
if (position != null)
setState(() {
_position = position;
});
});
๋ฒ์ : 2.1.1
ํ๋ซํผ:
๋น์ทํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ค์๊ฐ ์์น ์ ๋ฐ์ดํธ๋ฅผ ์ํด ์คํธ๋ฆผ์ ์ฌ์ฉํ๋ ์ค์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์๋ฎฌ๋ ์ดํฐ์์ ๋ด ์์น๊ฐ ๊ณ ์ ๋๋ฉด ์ ๋ฐ์ดํธ๊ฐ ์ ์์ ์ผ๋ก ์๋ํฉ๋๋ค. ๋๋ฒ๊ทธ / ์์น์์ ์์น๋ฅผ ๋ช ๋ฒ ์ ๋ฐ์ดํธํ๋ฉด์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
[VERBOSE-2 : ui_dart_state.cc (148)] ์ฒ๋ฆฌ๋์ง ์์ ์์ธ : PlatformException (ERROR_UPDATING_LOCATION, ์์ ์ ์๋ฃ ํ ์ ์์ต๋๋ค. (kCLErrorDomain ์ค๋ฅ 0.), null)
๊ตฌ์ฑ
geolocator ์ฌ์ฉ : '3.0.0'
iOS ์๋ฎฌ๋ ์ดํฐ (12.1) ๋ฐ ์ฅ์น (12.1.4)
๋๋ ์ด๊ฒ์ ๋ ์กฐ์ฌํ๊ณ ์์ผ๋ฉฐ ๊ณง ์ ๋ฐ์ดํธ ๋ ๊ฒ์ ๋๋ค.
iOS ์๋ฎฌ๋ ์ดํฐ 10.1, 11.1์์ ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํฉ๋๋ค.
์ฌ์ฉ-์๋ฎฌ๋ ์ดํฐ-> ๋๋ฒ๊ทธ-> ์์น-> ๊ณ ์๋๋ก ๋๋ผ์ด๋ธ
12.1์์ ์คํจ
์ฌ์ฉ-์๋ฎฌ๋ ์ดํฐ-> ๋๋ฒ๊ทธ-> ์์น-> ๊ณ ์๋๋ก ๋๋ผ์ด๋ธ
PlatformException (ERROR_UPDATING_LOCATION, ์์
์ ์๋ฃ ํ ์ ์์ต๋๋ค.
geolocator ์์ 12.1์์ ์คํจ
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์ด์
์ง์ค. ์ ๊ณต๋ ์์ ์์๋ ๋ฐ์ํฉ๋๋ค.
์๋ ํ์ธ์, ์ ๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ๋ณด๊ณ ์์ง๋ง ์ ์๊ฒ๋ ๋จผ์ "๋์ ์์ ๊ฑฐ ํ๊ธฐ"๋ฅผ ์๋ํด ๋ณด์๊ณ ํจ๊ณผ๊ฐ์์์ต๋๋ค! ๊ทธ๋ฌ๋์ด ์ค๋ฅ์ ํจ๊ป "city run"์ผ๋ก ์ ํ ํ ๋ ์คํจํ์ต๋๋ค.
๋ฐ๋ผ์ City Bicycle Ride๋ ๊ทธ ๋์ ์ฌ์ฉํ ์์๋ ํ๋กํ์ด ๋ ์ ์์ต๋๋ค.
ํธ์ง 1 : ๊ทธ๋ฆฌ๊ณ ์ด์ ์์ ๊ฑฐ ๋ชจ๋๋ ์๋์ ๋ฉ์ท์ต๋๋ค!
ํธ์ง 2 : ์ฑ์ ์ ๊ฑฐํ๊ณ ์์น ์ก์ธ์ค๋ฅผ ๋ค์ ํ์ฉํ๋ฉด์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋๋ ์ด๊ฒ๋๋ณด๊ณ ์๋ค. ๋๋ ์ด๊ฒ์ ํด๊ฒฐํ๊ธฐ ์ํด ์ด๊ฒ์ํ๋ค.
StreamSubscription<Position> _positionStream;
void _streamLocation() {
// TODO: initialize _positionStream
_positionStream.onError((e) {
print("error streaming position: $e");
_disposePositionStream();
_streamLocation();
});
}
void _disposePositionStream() {
if (_positionStream != null) {
_positionStream.cancel();
_positionStream = null;
}
}
์คํธ๋ฆผ์ ๋ค์ ์์ํ๋ฉด ์ด์ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฐธ๊ณ :์ด ๋๋ง์ด ์ฒ๋ฆฌํ๋ ์ต์ ์ ๋ฐฉ๋ฒํ์ง ์์ _positionStream
์ฌ์ ํ ์ฌ์ฉํ๊ณ ์๋ ๋์ onError
.
์์ ์ฑ์ ์ฌ์ฉํ์ฌ ์ฌ์ ํ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
Single์ ์๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง ๋๋๋ก null์๋ณด๊ณ ํ์ง๋ง ๋ช ๊ฐ์ง ์
๋ฐ์ดํธ ํ ์คํธ๋ฆผ์ด ์คํจํฉ๋๋ค.
PlatformException (ERROR_UPDATING_LOCATION, ์์ ์ ์๋ฃ ํ ์ ์์ต๋๋ค. (kCLErrorDomain ์ค๋ฅ 0.), null)
๊ตฌ์ฑ (ํ์ฌ)
geolocator ์ฌ์ฉ : "5.1.1 + 1"
iOS ์๋ฎฌ๋ ์ดํฐ (12.4) ๋ฐ ์ฅ์น (10.xx)
ํดํน ํ ์คํธ๋ฅผ ํตํด ..
LocationTask.m
์ด๊ฒ์ Simulator 12.4 ๋ฐ 10.3์์ ์์ ์ ์ผ๋ก ์๋ํฉ๋๋ค.
์๋ฎฌ๋ ์ดํฐ ๋๋ฒ๊ทธ๋ฅผ ๊ธฐ์ตํ์ญ์์ค. ์์น๋ ๋๋๋ก ๋ณ๊ฒฝ๋๊ธฐ ์ ์ ๋ช ๋ฒ ํฅ์ํด์ผํฉ๋๋ค.
์๊ฐ?
๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ต์ ๋ฒ์ ์ผ๋ก ์ ๋ฐ์ดํธ ํ ํ์๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ช ๊ฐ์ง ํ ์คํธ ํ WiFi๊ฐ ์ผ์ ธ์์ ๋ ์์ธ๊ฐ ๋ฐ์ํ์์ ๋ฐ๊ฒฌํ์ผ๋ฉฐ 3g๋ฅผ ํ์ฑํํ๋ฉด ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํฉ๋๋ค. ์ด๊ฒ์ ๋ํ ํด๊ฒฐ์ฑ ์ด ์์ต๋๊น?
๋น์ทํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. londonappbrewery์์ ๊ณผ์ ์ ์๋ฃํ๋ ค๊ณ ํฉ๋๋ค. ๋ค์ ์์ธ๊ฐ ๋ฐ์ํฉ๋๋ค! ๊ทธ๊ฒ์ ๊ณ ์น๋ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅธ๋ค : /
์ํธ:
๋ฒํผ์ ๋๋ฅด๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ์๋ฉ๋๋ค.
๋๋ฒ๊ทธ ๋ชจ๋์์ iPhone Xส์์ lib / main.dart ์คํ ์ค ...
Xcode ๋น๋ ์คํ ์ค ...
Xcode ๋น๋๊ฐ ์๋ฃ๋์์ต๋๋ค. 24.1 ์ด
๊ธฐ๊ธฐ iPhone Xส์ ํ์ผ ๋๊ธฐํ ์ค ...
[VERBOSE-2 : ui_dart_state.cc (148)] ์ฒ๋ฆฌ๋์ง ์์ ์์ธ : PlatformException (ERROR_UPDATING_LOCATION, ์์
์ ์๋ฃ ํ ์ ์์ต๋๋ค. (kCLErrorDomain ์ค๋ฅ 0.), null)
Android ์๋ฎฌ๋ ์ดํฐ (Pixel 3a API 28)์์๋ ์คํ ํด ๋ณด์์ต๋๋ค. ์๋ํ์ง๋ง ๋ถํํ๋ ์๋ชป๋ ์ขํ๋ฅผ ์ ๊ณตํ๊ณ ์์ต๋๋ค. ์ขํ์ ์ฐจ์ด๊ฐ ํฝ๋๋ค. ์๋ฅผ ๋ค์ด, ์ ๋ ํํค์คํ์์ ์์น๋ฅผ ์ป๊ณ ๋ฏธ๊ตญ ์ด๋๊ฐ์ ์์น๋ฅผ ํ์ํ๋ ค๊ณ ํฉ๋๋ค.
๋๋ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ์ผ๋ฉฐ ๋ด ํด๊ฒฐ์ฑ
์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋๋ฒ๊ทธ-> ์์น->
์ฌ๊ธฐ๋ฅผ ์ฒดํฌํ์ ๋ '์์'๊ณผ '์ฌ์ฉ์ ์ง์ ์์น'๊ฐ ์ ํ๋์ง ์์๊ณ , ๋ณด์๋๋๋ก ์ต์ ์ ์ ํํ๊ณ ์๋ํ์ต๋๋ค.
Sentry์์ ์์ฐ์ค์ธ iOS ์ฅ์น์์๋์ด ๋ด์ฉ์ ๋ณผ ์ ์์ต๋๋ค. ์ค์๊ฐ ์์น ์
๋ฐ์ดํธ๋ฅผ ์ฌ์ฉํ์ง ์๊ณ getCurrentPosition
/ getLastKnownPosition
์ ํํ๊ธฐ ๋งํ๋ฉด๋ฉ๋๋ค.
PlatformException: PlatformException(ERROR_UPDATING_LOCATION, The operation couldnโt be completed. (kCLErrorDomain error 0.), null)
File "message_codecs.dart", line 569, in StandardMethodCodec.decodeEnvelope
File "framework.dart", line 3919, in ComponentElement.mount
File "framework.dart", line 3101, in Element.inflateWidget
File "framework.dart", line 2904, in Element.updateChild
File "framework.dart", line 5127, in SingleChildRenderObjectElement.mount
File "framework.dart", line 3101, in Element.inflateWidget
File "framework.dart", line 2904, in Element.updateChild
File "framework.dart", line 3961, in ComponentElement.performRebuild
File "framework.dart", line 3738, in Element.rebuild
File "framework.dart", line 3924, in ComponentElement._firstBuild
File "framework.dart", line 4088, in StatefulElement._firstBuild
File "framework.dart", line 3919, in ComponentElement.mount
.
.
.
์์ด๋์ด?
๋ค์ ์ฝ๋๋ ์ ์๊ฒ ๋์ผํ ์ค๋ฅ๋ฅผ ์์ฑํฉ๋๋ค.
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
class LoadingScreen extends StatefulWidget {
<strong i="6">@override</strong>
_LoadingScreenState createState() => _LoadingScreenState();
}
class _LoadingScreenState extends State<LoadingScreen> {
void getLocation() async {
Position position = await Geolocator()
.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
print(position);
}
<strong i="7">@override</strong>
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
onPressed: () {
getLocation();
},
child: Text('Get Location'),
),
),
);
}
}
์๋๋ก์ด๋ ์คํ๋์ค 3.5.3
๋น๋ # AI-191.8026.42.35.6010548, 2019 ๋
11 ์ 15 ์ผ์ ๋น๋ ๋จ
JRE : 1.8.0_202-release-1483-b49-5587405 x86_64
JVM : JetBrains sro์ OpenJDK 64 ๋นํธ ์๋ฒ VM
macOS 10.15.2
geolocator-5.1.5
location_permissions-2.0.3
ํ๋ฌํฐ ๋ฒ์ : v1.13.5
์๋ฎฌ๋ ์ด์ ๊ธฐ์์ ์คํ : Iphone 11 Pro Max 13.3
@softronaut๊ฐ ์ ์ํ๋๋ก ์๋ฎฌ๋ ์ดํฐ ์ฑ์์ ์์น๋ฅผ ์ค์ ํ๋ฉด ์ค๋ฅ๊ฐ ์ ๊ฑฐ๋ฉ๋๋ค. ๋ฐ๋ผ์ ๊ฐ์ ๋ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๋์์ด ๋ ๊ฒ์ ๋๋ค. ์ ๊ฒฝ์ฐ์๋ ์์น๊ฐ ์ค์ ๋์ง ์์๊ธฐ ๋๋ฌธ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
๋น์ทํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. londonappbrewery์์ ๊ณผ์ ์ ์๋ฃํ๋ ค๊ณ ํฉ๋๋ค. ๋ค์ ์์ธ๊ฐ ๋ฐ์ํฉ๋๋ค! ๊ทธ๊ฒ์ ๊ณ ์น๋ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅธ๋ค : /
์ํธ:
๋ฒํผ์ ๋๋ฅด๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ์๋ฉ๋๋ค.
๋๋ฒ๊ทธ ๋ชจ๋์์ iPhone Xส์์ lib / main.dart ์คํ ์ค ...
Xcode ๋น๋ ์คํ ์ค ...
Xcode ๋น๋๊ฐ ์๋ฃ๋์์ต๋๋ค. 24.1 ์ด
๊ธฐ๊ธฐ iPhone Xส์ ํ์ผ ๋๊ธฐํ ์ค ...
[VERBOSE-2 : ui_dart_state.cc (148)] ์ฒ๋ฆฌ๋์ง ์์ ์์ธ : PlatformException (ERROR_UPDATING_LOCATION, ์์ ์ ์๋ฃ ํ ์ ์์ต๋๋ค. (kCLErrorDomain ์ค๋ฅ 0.), null)0 StandardMethodCodec.decodeEnvelope (ํจํค์ง : flutter / src / services / message_codecs.dart : 569 : 7)
1 MethodChannel.invokeMethod (ํจํค์ง : flutter / src / services / platform_channel.dart : 316 : 33)
2 Geolocator.getCurrentPosition (ํจํค์ง : geolocator / geolocator.dart : 103 : 32)
3 _LoadingScreenState.getLocation (ํจํค์ง : clima / screens / loading_screen.dart : 12 : 10)
4 _LoadingScreenState.build. (ํจํค์ง : clima / screens / loading_screen.dart : 22 : 13)
5 _InkResponseState._handleTap (ํจํค์ง : flutter / src / material / ink_well.dart : 654 : 14)
6 _InkResponseState.build. (ํจํค์ง : flutter / src / material / ink_well.dart : 729 : 32)
7 GestureRecognizer.invokeCallback (ํจํค์ง : flutter / src / gestures / recognizer.dart : 182 : 24)
8 <โฆ>
Android ์๋ฎฌ๋ ์ดํฐ (Pixel 3a API 28)์์๋ ์คํ ํด ๋ณด์์ต๋๋ค. ์๋ํ์ง๋ง ๋ถํํ๋ ์๋ชป๋ ์ขํ๋ฅผ ์ ๊ณตํ๊ณ ์์ต๋๋ค. ์ขํ์ ์ฐจ์ด๊ฐ ํฝ๋๋ค. ์๋ฅผ ๋ค์ด, ์ ๋ ํํค์คํ์์ ์์น๋ฅผ ์ป๊ณ ๋ฏธ๊ตญ ์ด๋๊ฐ์ ์์น๋ฅผ ํ์ํ๋ ค๊ณ ํฉ๋๋ค.
iOS ์๋ฎฌ๋ ์ดํฐ-> ๊ธฐ๋ฅ-> ์์น-> ์ฌ์ฉ์ ์ง์ ์์น ...
๊ธฐ๋ฅ> ์์น> ์ฌ์ฉ์ ์ง์ ์์น์์ ์๋ฎฌ๋ ์ดํฐ์ ์ฌ์ฉ์ ์ง์ ์์น๋ฅผ ์ค์ ํด์ผํฉ๋๋ค.
locati onManager : didUpdateLocations :
[CurrentLocationTask dealloc]
[LocationTask dealloc]
iOS ์๋ฎฌ๋ ์ดํฐ-> ๊ธฐ๋ฅ-> ์์น-> ์ฌ์ฉ์ ์ง์ ์์น๋ฅผ ๋ฐ๋๋๋ฐ ์ด์ ์์ ๋ฉ์์ง๊ฐ ํ์๋ฉ๋๋ค. ์ด๊ฒ ๋ญ์ผ?
๋๋ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ์ผ๋ฉฐ ๋ด ํด๊ฒฐ์ฑ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋๋ฒ๊ทธ-> ์์น->์ฌ๊ธฐ๋ฅผ ์ฒดํฌํ์ ๋ '์์'๊ณผ '์ฌ์ฉ์ ์ง์ ์์น'๊ฐ ์ ํ๋์ง ์์๊ณ , ๋ณด์๋๋๋ก ์ต์ ์ ์ ํํ๊ณ ์๋ํ์ต๋๋ค.
์ง๊ธ๊น์ง์ด ์ต์ ์ ๋ช ๋ฒ ์ค์ ํด์ผํ์ต๋๋ค. ์ด๋ค ์ด์ ๋ก ๋๋๋ก ์ค์ ์ด ์์ฒด์ ์ผ๋ก ์ฌ์ค์ ๋ฉ๋๋ค. ์ ์ด๊ฒ์ด์ธ์ง ์๋ ์ฌ๋ ์์ต๋๊น?
์ ๋ฐ์ดํธ๋์์ต๋๋ค. ์ด์ ๊ธฐ๋ฅ-> ์์น-> ์ต์ ์ ํ์ ์์ต๋๋ค.
๋ฒ์ 6.0.0์์ ํด๊ฒฐ๋จ
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋ ๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํ์ผ๋ฉฐ ๋ด ํด๊ฒฐ์ฑ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋๋ฒ๊ทธ-> ์์น->
์ฌ๊ธฐ๋ฅผ ์ฒดํฌํ์ ๋ '์์'๊ณผ '์ฌ์ฉ์ ์ง์ ์์น'๊ฐ ์ ํ๋์ง ์์๊ณ , ๋ณด์๋๋๋ก ์ต์ ์ ์ ํํ๊ณ ์๋ํ์ต๋๋ค.