diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9f372a8..88d18ba 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -97,7 +97,6 @@ F71CB638C8651D72D3F3F2E8 /* Pods-RunnerTests.release.xcconfig */, 74EC6693A0D90253C1EB11C6 /* Pods-RunnerTests.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -453,6 +452,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -463,6 +463,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -487,6 +488,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 5867QGN5CL; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -574,6 +576,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -584,6 +587,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -629,6 +633,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -639,6 +644,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -665,6 +671,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 5867QGN5CL; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -687,6 +694,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = 5867QGN5CL; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 87131a0..5eb0515 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -59,7 +59,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES"> + allowLocationSimulation = "NO"> { - late AMapController _mapController; + AMapController? _mapController; Map _locationResult = {}; late StreamSubscription> _locationListener; final AMapFlutterLocation _locationPlugin = AMapFlutterLocation(); @@ -75,7 +75,8 @@ class _MapWidgetState extends State { requestAccuracyAuthorization(); } - _locationPlugin.setLocationOption(AMapLocationOption()); + var option = AMapLocationOption(); + _locationPlugin.setLocationOption(option); ///注册定位结果监听 _locationListener = _locationPlugin @@ -87,6 +88,10 @@ class _MapWidgetState extends State { print("location=$_locationResult"); }); _locationPlugin.startLocation(); + WidgetsBinding.instance.addPostFrameCallback((_) { + // 在页面渲染完成后执行代码 + // 例如,你可以在此处执行需要在页面加载完成后执行的操作 + }); } @override @@ -108,7 +113,7 @@ class _MapWidgetState extends State { _mapController = controller; getApprovalNumber(); }); - _mapController.moveCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(29.52,121.31)))); + _moveCamera(_locationResult); }, ); return Expanded( @@ -134,21 +139,24 @@ class _MapWidgetState extends State { )); } - void _moveCamera(Map result) { + void _moveCamera(Map result) { double lat = double.parse(result['latitude'] as String); double lng = double.parse(result['longitude'] as String); - _mapController.moveCamera( - CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat,lng)))); + if (_mapController != null) { + _mapController!.moveCamera(CameraUpdate.newCameraPosition( + CameraPosition(target: LatLng(lat, lng),zoom: 18))); + } + } ///获取审图号 void getApprovalNumber() async { //普通地图审图号 String? mapContentApprovalNumber = - await _mapController.getMapContentApprovalNumber(); + await _mapController?.getMapContentApprovalNumber(); //卫星地图审图号 String? satelliteImageApprovalNumber = - await _mapController.getSatelliteImageApprovalNumber(); + await _mapController?.getSatelliteImageApprovalNumber(); print('地图审图号(普通地图): $mapContentApprovalNumber'); print('地图审图号(卫星地图): $satelliteImageApprovalNumber'); }