Browse Source

docs: link aliyun-oss-react-native and repair initWithSecurityToken and initWithServerSTS

罗章 6 years ago
parent
commit
0b4122ff73
2 changed files with 29 additions and 22 deletions
  1. 9
    9
      README-CN.md
  2. 20
    13
      README.md

+ 9
- 9
README-CN.md View File

51
 react native项目下运行`react-native link`命令
51
 react native项目下运行`react-native link`命令
52
 
52
 
53
 ```script
53
 ```script
54
-react-native link
54
+react-native link aliyun-oss-react-native
55
 ```
55
 ```
56
 
56
 
57
 注意:由于react native脚手架不同版本的问题,有时候自动安装可能会失败,可手动添加android和iOS的的依赖库。同样为了兼容IPv6-Only网络,iOS工程中需参考aliyun-oss-ios-sdk说明中引入以下包。
57
 注意:由于react native脚手架不同版本的问题,有时候自动安装可能会失败,可手动添加android和iOS的的依赖库。同样为了兼容IPv6-Only网络,iOS工程中需参考aliyun-oss-ios-sdk说明中引入以下包。
193
 
193
 
194
 ### initWithPlainTextAccessKey(不建议)
194
 ### initWithPlainTextAccessKey(不建议)
195
 
195
 
196
-该接口需要通过明文授权acckeyId和accekeySecret,开发者这可以使用,但是我们不建议
196
+该接口需要通过明文授权accesskeyId和accesskeySecret,开发者这可以使用,但是我们不建议
197
 
197
 
198
 ```javascript
198
 ```javascript
199
 const endPoint = "XXX"
199
 const endPoint = "XXX"
202
     timeoutIntervalForRequest: 30,
202
     timeoutIntervalForRequest: 30,
203
     timeoutIntervalForResource: 24 * 60 * 60
203
     timeoutIntervalForResource: 24 * 60 * 60
204
  };
204
  };
205
-AliyunOSS.initWithPlainTextAccessKey(accessKey, secretKey, endPoint, configuration);
205
+AliyunOSS.initWithPlainTextAccessKey(accesskeyId, accesskeySecret, endPoint, configuration);
206
 ```
206
 ```
207
 
207
 
208
 ### initWithSigner
208
 ### initWithSigner
218
 该接口通过SecurityToken授权,参考[STS访问控制](https://help.aliyun.com/document_detail/32046.html?spm=a2c4g.11186623.2.8.dfV9i0),使用可查看
218
 该接口通过SecurityToken授权,参考[STS访问控制](https://help.aliyun.com/document_detail/32046.html?spm=a2c4g.11186623.2.8.dfV9i0),使用可查看
219
 
219
 
220
 ```
220
 ```
221
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
221
+AliyunOSS.initWithSecurityToken(SecurityToken, accessKeyId, accessKeySecret, endPoint, configuration);
222
 ```
222
 ```
223
 
223
 
224
 ### initWithServerSTS
224
 ### initWithServerSTS
226
 该接口通过本地鉴权服务器授权,使用可查看
226
 该接口通过本地鉴权服务器授权,使用可查看
227
 
227
 
228
 ```javascript
228
 ```javascript
229
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
229
+AliyunOSS.initWithSecurityToken(/*local auth server*/, endPoint, configuration);
230
 ```
230
 ```
231
 
231
 
232
 ### asyncUpload
232
 ### asyncUpload
241
 
241
 
242
 ```javascript
242
 ```javascript
243
  AliyunOSS.initMultipartUpload(bucketname,objectkey).then((e)=>{
243
  AliyunOSS.initMultipartUpload(bucketname,objectkey).then((e)=>{
244
-         console.log(e)
245
-         //e 为uploadId
244
+       //e 为uploadId
245
+       console.log(e)
246
     }).catch((error) => {
246
     }).catch((error) => {
247
-        console.log(error)
247
+       console.log(error)
248
  })
248
  })
249
 ```
249
 ```
250
 ### multipartUpload
250
 ### multipartUpload
280
 
280
 
281
 ```
281
 ```
282
  // xxx为图片处理选项,具体可查看官网
282
  // xxx为图片处理选项,具体可查看官网
283
- AliyunOSS.asyncDownload(bucketname,objectkey,{"x-oss-process":'xxxx'}).then((e) => {
283
+ AliyunOSS.asyncDownload(bucketname,objectkey,{"x-oss-process": 'xxxx'}).then((e) => {
284
     console.log(e)
284
     console.log(e)
285
   }).catch((e)=>{
285
   }).catch((e)=>{
286
     console.log(e)
286
     console.log(e)

+ 20
- 13
README.md View File

50
 run `react-native link` in the react native project
50
 run `react-native link` in the react native project
51
 
51
 
52
 ```
52
 ```
53
-react-native link
53
+react-native link aliyun-oss-react-native
54
+```
55
+
56
+`Note`:for suppport IPv6-Only networkd,you need to require :
57
+```javascript
58
+1. libresolv.tbd
59
+2. CoreTelephony.framework
60
+3. SystemConfiguration.framework
54
 ```
61
 ```
55
 
62
 
56
 ### Manual Installation
63
 ### Manual Installation
66
 - **no CocoaPods**
73
 - **no CocoaPods**
67
 
74
 
68
 1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ `Add Files to <...>` Go to `node_modules` ➜ `aliyun-oss-react-native` ➜ `ios` ➜ select `RNAliyunOSS.xcodeproj`
75
 1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ `Add Files to <...>` Go to `node_modules` ➜ `aliyun-oss-react-native` ➜ `ios` ➜ select `RNAliyunOSS.xcodeproj`
69
-2. Add `RNAliyun.a` to `Build Phases -> Link Binary With Libraries`
76
+2. Add `libRNAliyunOSS.a` to `Build Phases -> Link Binary With Libraries`
70
 3. In XCode, in the project navigator, right click `Frameworks` ➜ `Add Files to [your project's name]`. Go to `node_modules` ➜ `aliyun-oss-react-native` ➜ `AliyunSDK`. Add `AliyunOSSiOS.framework`, and select *Copy items if needed* in the pop-up box.
77
 3. In XCode, in the project navigator, right click `Frameworks` ➜ `Add Files to [your project's name]`. Go to `node_modules` ➜ `aliyun-oss-react-native` ➜ `AliyunSDK`. Add `AliyunOSSiOS.framework`, and select *Copy items if needed* in the pop-up box.
71
 
78
 
72
 #### Android
79
 #### Android
73
 1. Add the following lines to `android/settings.gradle`:
80
 1. Add the following lines to `android/settings.gradle`:
74
 
81
 
75
 ```gradle
82
 ```gradle
76
-include ':react-native-rn-sdk'
77
-project(':react-native-rn-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android')
83
+include ':react-native-react-sdk'
84
+project(':react-native-react-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/aliyun-oss-rn-sdk/android')
78
 ```
85
 ```
79
 
86
 
80
 2. Add the compile line to the dependencies in `android/app/build.gradle`:
87
 2. Add the compile line to the dependencies in `android/app/build.gradle`:
221
 
228
 
222
 init client with SecurityToken
229
 init client with SecurityToken
223
 
230
 
224
-```
225
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
231
+AliyunOSS.initWithSecurityToken(SecurityToken, accessKeyId, accessKeySecret, endPoint, configuration);
232
+
226
 ```
233
 ```
227
 
234
 
228
 ### initWithServerSTS
235
 ### initWithServerSTS
229
 
236
 
230
-init auth client with loacl auth server
237
+init auth client with local auth server
231
 
238
 
232
 ```javascript
239
 ```javascript
233
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
240
+AliyunOSS.initWithServerSTS(/*local auth server*/, endPoint, configuration);
234
 ```
241
 ```
235
 
242
 
236
 ### asyncUpload
243
 ### asyncUpload
237
 
244
 
238
 ```
245
 ```
239
-AliyunOSS.asyncUpload(bucketname, objectKye, filepath).then().catch()
246
+AliyunOSS.asyncUpload(bucketname, objectKey, filepath).then().catch()
240
 ```
247
 ```
241
 ### asyncAppendObject
248
 ### asyncAppendObject
242
 ### asyncResumableUpload
249
 ### asyncResumableUpload
243
 ### initMultipartUpload
250
 ### initMultipartUpload
244
 
251
 
245
 ```javascript
252
 ```javascript
246
- AliyunOSS.initMultipartUpload(bucketname,objectkey).then((e)=>{
247
-         console.log(e)
248
-         //e is uploadId
253
+ AliyunOSS.initMultipartUpload(bucketname,objectkey).then((e) => {
254
+      //e is uploadId
255
+      console.log(e)
249
     }).catch((error) => {
256
     }).catch((error) => {
250
-        console.log(error)
257
+      console.log(error)
251
  })
258
  })
252
 ```
259
 ```
253
 ### multipartUpload
260
 ### multipartUpload