0%

1. Storyboard的Entry Point

选择一个ViewController,在Attributes Inspector中勾选Is Initial View Controller

2. Storyboard的导航

有两个导航Navigation ControllerTab Bar Controller,这两个在Editor-Embed In->Navigation Controller/Tab Bar Controller.加上去之后,根组件就会变成这两个。self.navigationController才会有值,不然是nil。

Read more »

1. 基本命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 运行镜像
docker run -t -i ubuntu:14.04 /bin/bash

# 查看运行的容器
docker ps

# 查看所有容器
docker ps -a

# 进入容器
docker exec -it $container_id /bin/bash

# 停用某个容器
docker stop $container_id

# 停用全部运行中的容器
docker stop $(docker ps -q)

# 杀死所有running状态的容器
docker kill $(docker ps -q)

# 查看镜像,不包含中间镜像
docker images

# 查看所有镜像,其中包含中间镜像
docker images -a

# 进入正在运行的容器
docker exec -it $container_id /bin/bash

# 给iamge改名
docker tag IMAGEID(镜像id) REPOSITORY:TAG(仓库:标签)

# 查看日志 docker logs 参数 容器名/容器id
docker logs -t -n 5 fe734a934051
Read more »

1. React Naitve启动顺(Android)

  1. ReactActivity->onCreate()
  2. MainApplication->mReactNativeHost.getPackages()
  3. ScannerPackage->Scanner.initScannerModule
    Read more »

1.集成react-native-maps

集成谷歌地图,分两步,客户端集成与Google Api设置。难点是Google Service的版本统一,iOS集成,Google Api设置。

  • Android的构建工具是gradle,所以集成还算方便,最多改下buildToolsVersion, targetVersion, Google Service使用一个全局变量来统一版本。
  • iOS可以手动集成,也可以用cocoaPods,难点在于同时使用这两个。react-native-maps我是用pod,创建PodFile后运行pod install,使用.xcworkspace打开,pod所有的依赖都打包到一起。
  • Google Map APi设置,需要分Android和iOS两个,开发环境也要分成2个,所以一共要4个。

1.集成react-native-google-signin

一开始我看最新版本是需要Google Service15,我想兼容性好用Google Service的11.8.0版本。所以一开始用了它的0.11版本。

  • Android上改了module的buildToolsVersion,把compileOnly,implementation改成compile.Java文件中@Override
    Android需要下载Google-Service,这个是Firebase导出的,事实上我们用不到Firebase。Firebase-core是analytics的别名,它的大部分功能是用来统计数据的,比如ads,crashlytics,google analtytics。Firbase-auth是可以支持更多的登录,跟Google-signin不一样。
  • iOS集成,我之前用cocoaPods安装了react-native-maps,一开始我手动集成react-native-google-signin,发现Arguments too long,按照FaceBook的说法是Header Search Paths里面的pod路径和手工路径重复了,可是我没有重复的;使用pod集成,找不到各种文件。
  • Google Signin Api跟Map Api差不多,唯一不同的是需要Android的packageName和SHA1指纹,iOS需要bunldeId。

如果再次引入其他包,可以主项目引入,然后加上Header Search Paths.iOS需要头文件和lib一起工作,如果主项目用到了头文件或者Framework用到了头文件,那么头文件路径需要设置(Framework可以到.framework文件夹,自定义头文件的需要到头文件文件夹路径)。

解决方案: 使用了最新的1.0.0-rc3,然后iOS就可以了,Android把Google Service的版本降低了。下次集成先集成iOS,Android相对容易些。

配置中,Android使用了webClientId,iOS使用了iOSClientId和webClientId.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { GoogleSignin, GoogleSigninButton } from 'react-native-google-signin'

if (IsAndroid) {
GoogleSignin.configure({
// scopes: ["https://www.googleapis.com/auth/drive.readonly"], // what API you want to access on behalf of the user, default is email and profile
webClientId: androidWebClientId,
offlineAccess: false,// if you want to access Google API on behalf of the user FROM YOUR SERVER
forceConsentPrompt: true // [Android] if you want to show the authorization prompt at each login
})
} else {
GoogleSignin.configure({
iosClientId: iosClientId, // only for iOS
webClientId: iOSWebClientId, // required, shoudle use same project name as iosClientId
offlineAccess: false,// if you want to access Google API on behalf of the user FROM YOUR SERVER
})
}

Read more »

下面的所述的是针对mongoDB4版本。

1.配置文件

Mac下在的tar文件,默认自带ssl,但是4.0版本默认不支持Openss 1.0版本,为了使用Openssl1.0版本所以配置文件中需要去掉SSL高版本的支持(disabledProtocols),

Read more »

1.rvm

管理不同的ruby版本。

1
2
rvm list #列出不同的ruby版本
rvm use 2.4.1 --default #使用ruby 2.4.1做为默认版本

2.gem

管理ruby的库文件。

1
2
3
4
gem install cocoapods #安装cocoapods到全局环境
gem environment # gem的环境,看gem的安装目录
gem list --local #看gem中库的版本,如果看到一个库有2个不同版本,说明在2个路径都可以查到,比如/usr/local/bin和$HOME/.rvm/gems/ruby-2.4.1/bin/bundler
gem cleanup #清除gem的缓存,当gem中lib太多会导致很卡,因为ruby运行会遍历lib下的所有库,这个查找依赖的方式十分地低效。。

https://blog.csdn.net/u014621915/article/details/62221705

Read more »

1.查看private key

openssl pkcs8 -in my_private_key -passin mypassworld
openssl pkcs12 -info -in my_private_key -passin mypassworld

注意不同的加密格式对应不同命令

Read more »

1.JNI 引用**.so

1.1 放到main下面的jniLibs

在app/src/main/jniLibs下按照硬件分文件夹放**.so(jniLibs好像大小写不分)

1.2 修改build.gradle

在项目目录下的app/libs下按照硬件分文件夹放**.so

1
2
3
4
5
6
7
android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}

https://blog.csdn.net/shengyingpo/article/details/51538444

1.3 注意ndk的编译选项

如果没有提供硬件平台就不需要选择,不然APP会到相应目录下寻找.so文件。

1
2
3
4
5
6
7
8
android {
defaultConfig {
// 指定支持的so架构
ndk {
abiFilters 'armeabi' //, 'x86', 'x86_64', 没有就不用选。
}
}
}

2. Android Studio

2.1智能提示

有时候第三方的jar包放到libs下时,不会智能提示,gradlew clean也没有用,这个时候就是之前设置有过问题,去File->Invalidate Caches/Restart -> Invalidate and Restart, 然后就修复了。
https://blog.csdn.net/Sailor_luo/article/details/80277695

https://blog.csdn.net/ToBeTheOnlyOne/article/details/78491024