Procházet zdrojové kódy

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

罗章 před 6 roky
rodič
revize
0b4122ff73
2 změnil soubory, kde provedl 29 přidání a 22 odebrání
  1. 9
    9
      README-CN.md
  2. 20
    13
      README.md

+ 9
- 9
README-CN.md Zobrazit soubor

@@ -51,7 +51,7 @@ yarn install aliyun-oss-react-native --save
51 51
 react native项目下运行`react-native link`命令
52 52
 
53 53
 ```script
54
-react-native link
54
+react-native link aliyun-oss-react-native
55 55
 ```
56 56
 
57 57
 注意:由于react native脚手架不同版本的问题,有时候自动安装可能会失败,可手动添加android和iOS的的依赖库。同样为了兼容IPv6-Only网络,iOS工程中需参考aliyun-oss-ios-sdk说明中引入以下包。
@@ -193,7 +193,7 @@ AliyunOSS.enableDevMode()
193 193
 
194 194
 ### initWithPlainTextAccessKey(不建议)
195 195
 
196
-该接口需要通过明文授权acckeyId和accekeySecret,开发者这可以使用,但是我们不建议
196
+该接口需要通过明文授权accesskeyId和accesskeySecret,开发者这可以使用,但是我们不建议
197 197
 
198 198
 ```javascript
199 199
 const endPoint = "XXX"
@@ -202,7 +202,7 @@ const configuration = {
202 202
     timeoutIntervalForRequest: 30,
203 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 208
 ### initWithSigner
@@ -218,7 +218,7 @@ AliyunOSS.initWithSigner(signature, accessKey, endPoint, configuration);
218 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 224
 ### initWithServerSTS
@@ -226,7 +226,7 @@ AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
226 226
 该接口通过本地鉴权服务器授权,使用可查看
227 227
 
228 228
 ```javascript
229
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
229
+AliyunOSS.initWithSecurityToken(/*local auth server*/, endPoint, configuration);
230 230
 ```
231 231
 
232 232
 ### asyncUpload
@@ -241,10 +241,10 @@ AliyunOSS.asyncUpload(bucketname, objectKey, filepath).then().catch()
241 241
 
242 242
 ```javascript
243 243
  AliyunOSS.initMultipartUpload(bucketname,objectkey).then((e)=>{
244
-         console.log(e)
245
-         //e 为uploadId
244
+       //e 为uploadId
245
+       console.log(e)
246 246
     }).catch((error) => {
247
-        console.log(error)
247
+       console.log(error)
248 248
  })
249 249
 ```
250 250
 ### multipartUpload
@@ -280,7 +280,7 @@ AliyunOSS.listParts(multipartBucket,multipartObjectKey,upoadId).then((e)=>{
280 280
 
281 281
 ```
282 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 284
     console.log(e)
285 285
   }).catch((e)=>{
286 286
     console.log(e)

+ 20
- 13
README.md Zobrazit soubor

@@ -50,7 +50,14 @@ yarn install aliyun-oss-react-native --save
50 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 63
 ### Manual Installation
@@ -66,15 +73,15 @@ pod 'aliyun-oss-react-native', :path => '../node_modules/aliyun-oss-react-native
66 73
 - **no CocoaPods**
67 74
 
68 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 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 79
 #### Android
73 80
 1. Add the following lines to `android/settings.gradle`:
74 81
 
75 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 87
 2. Add the compile line to the dependencies in `android/app/build.gradle`:
@@ -221,33 +228,33 @@ AliyunOSS.initWithSigner(signature, accessKey, endPoint, configuration);
221 228
 
222 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 235
 ### initWithServerSTS
229 236
 
230
-init auth client with loacl auth server
237
+init auth client with local auth server
231 238
 
232 239
 ```javascript
233
-AliyunOSS.initWithSecurityToken(signature, accessKey, endPoint, configuration);
240
+AliyunOSS.initWithServerSTS(/*local auth server*/, endPoint, configuration);
234 241
 ```
235 242
 
236 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 248
 ### asyncAppendObject
242 249
 ### asyncResumableUpload
243 250
 ### initMultipartUpload
244 251
 
245 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 256
     }).catch((error) => {
250
-        console.log(error)
257
+      console.log(error)
251 258
  })
252 259
 ```
253 260
 ### multipartUpload