npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@uiw/react-native-transport-location

v1.0.9

Published

部网络货运信息交互系统位置信息上报

Downloads

5

Readme

@uiw/react-native-transport-location

部网络货运信息交互系统位置信息上报

注意事项

Android

创建配置文件 android/app/src/main/res/xml/network_security_config.xml 内容如下:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

修改配置 android/app/src/main/AndroidManifest.xml

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
+  android:networkSecurityConfig="@xml/network_security_config"
  android:theme="@style/AppTheme">
</application>

iOS

修改 ios/<应用名称>/Info.plist 配置

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

GMObjC 里面用到的 OpenSSL 配置 armv7 有问题,GMObjC.framework 动态包也是只支持 ARM64

设置 Xcode -> Targets -> 项目名称 -> Build Settings -> Architectures 值为 arm64

example/ios/<项目名称>/Info.plist

iOS 11 版本:

NSLocationAlwaysAndWhenInUseUsageDescription 申请Always权限,以便应用在前台和后台(suspend 或 terminated)都可以获取到更新的位置数据(NSLocationWhenInUseUsageDescription 也必须有)。

⚠️ 注意:如果需要同时支持在iOS8-iOS10和iOS11系统上后台定位,建议在plist文件中同时添加 NSLocationWhenInUseUsageDescriptionNSLocationAlwaysUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescription权限申请。

<key>NSLocationWhenInUseUsageDescription</key>
<string>使用期间定位,以便获取位置信息</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>持续定位,以便获取行驶路线</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>持续定位,以便获取行驶路线</string>

不支持 bitcode,什么是bitcode

bitcode 简单说就是编程语言与计算机可以直接执行的机器语言之间的中间码。苹果为了减少包的大小,打包时会将项目编译成 bitcode,上传给 App Store,用户下载时,bitcode 可以根据机型版本,生成不同的包去适配。大概就是这么个意思,具体内容请戳这里

解决方案

Xcode7 开始,新建项目默认就打开了 bitcode 设置。而且大部分开发者都被这个突如其来的 bitcode 功能给坑过导致项目编译失败,这些因为 bitcode 而编译失败的的项目都有一个共同点,就是链接了第三方库或者框架,而这些框架或者库不支持 bitcode ,从而导致项目编译不成功。 解决方案有两种(目前只有第二种解决方案):

  1. 联系第三方框架 MapManager.framework 的提供者,让他们支持 bitcode,这个执行起来有难度。
  2. 关闭 bitcode 功能;在 xcode 里把 TARGETS -> Build Setting -> Build Options -> Enable Bitcode 设置为 NO;

报错信息

ld: bitcode bundle could not be generated because '******/react-native-transport-location/ios/MapManager.framework/MapManager(MapService.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • ⚠️ 高德地图定位部分 API 需要真机调试和 Access WiFi Information 权限。
  • 适用于 react-native >= 0.60+ 低版本未测试。
  • 支持手机系统:iOS(苹果)、Android(安卓)。
  • 需要设置允许 HTTP 请求访问
  • React Native 带的自带的包 OpenSSL-UniversalGMObjC 自带的 GMOpenSSL 冲突 已解决 #1

安装依赖

yarn add @uiw/react-native-transport-location
# react-native version >= 0.60+
$ cd ios && pod install

AndroidManifest.xml

<meta-data android:name="com.amap.api.v2.apikey" android:value="{你的高德key}" />

api

  • init
  • start
  • end

其它

当前工程基于 @brodybits/create-react-native-module 初始化。

npx create-react-native-module --package-identifier com.uiwjs.react.transport.location --object-class-name RNTransportLocation --generate-example TransportLocation --example-react-native-version 0.63.3 --module-name @uiw/react-native-transport-location --github-account uiwjs --author-name "Kenny Wong" --author-email "[email protected]"

开发

cd example   # 进入实例 example 工程,根目录不需要安装,会引发错误
yarn install # 安装依赖

cd ios     # 进入 example/ios 目录安装依赖
pod install # 安装依赖