作为 react-native-amap3d 的补充,提供独立的定位模块,支持逆地理编码。
image用法
import { Geolocation } from "react-native-amap-geolocation"
await Geolocation.init({
ios: "9bd6c82e77583020a73ef1af59d0c759",
android: "043b24fe18785f33c491705ffe5b6935"
})
Geolocation.setOptions({
interval: 8000,
distanceFilter: 20
})
Geolocation.addLocationListener(location => console.log(location))
Geolocation.start()
网友评论
E:\LianjiangProject\GongJiang\android\app\src\main\java\com\gongjiang\MainApplication.java:6: 错误: 程序包cn.qiuxiang.react.geolocation不存在
import cn.qiuxiang.react.geolocation.AMapGeolocationPackage;
^
E:\LianjiangProject\GongJiang\android\app\src\main\java\com\gongjiang\MainApplication.java:28: 错误: 找不到符号
new AMapGeolocationPackage(),
^
符号: 类 AMapGeolocationPackage
2 个错误
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 31.141 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `react-native-amap-geolocation` from `../node_modules/react-native-amap-geolocation/lib/ios`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Installing AMapFoundation (1.5.3)
Installing AMapLocation (2.6.0)
Using DoubleConversion (1.1.5)
Using Folly (2016.10.31.00)
Installing React 0.56.0
Using boost-for-react-native (1.63.0)
Using glog (0.3.4)
Installing react-native-amap-geolocation (0.3.1)
Using yoga (0.56.0.React)
[!] The 'Pods-ddh' target has transitive dependencies that include static binaries: (/Users/sea/Desktop/ddh/ios/Pods/AMapLocation/AMapLocationKit.framework)
[!] 'AMapFoundation' uses the unencrypted http protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts in there. Please reach out to the library author to notify them of this security issue.
[!] 'AMapLocation' uses the unencrypted http protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts in there. Please reach out to the library author to notify them of this security issue.
红色感叹号,如何处理
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/DoubleConversion'
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/Folly'
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/React'
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/glog'
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/react-native-amap-geolocation'
ld: warning: directory not found for option '-L/Users/jiangsong/Library/Developer/Xcode/DerivedData/playball-bjlyweameocqvxgmyadwanlslgdb/Build/Products/Debug-iphonesimulator/yoga'
ld: library not found for -lDoubleConversion
clang: error: linker command failed with exit code 1 (use -v to see invocation)