Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传图像在Android emulator运行通畅但在安桌手机上stuck #90

Open
emclab opened this issue Jan 25, 2022 · 1 comment
Open

Comments

@emclab
Copy link

emclab commented Jan 25, 2022

应用是RN 0.66。 以下是code。保存image在安卓手机上总是在进行中,也不出错。怀疑是Init有network错误。App已经允许http

android:usesCleartextTraffic="true"

如何fix这个问题?

import AliyunOSS from 'aliyun-oss-react-native';
AliyunOSS.initWithSecurityToken(STSConfig.SecurityToken,STSConfig.AccessKeyId,STSConfig.SecretKeyId,endPoint,configuration);  //《〈==network Error?
    const saveOSS = async (bucket_name, objkey, filePath) => {
        return (new Promise((resolve) => {
            AliyunOSS.asyncUpload(bucket_name, objkey, filePath).then( (res) => {
                //console.log("Success : ", res);
                resolve(true);
            }).catch((error)=>{
                setTimeout(()=> {
                    AliyunOSS.asyncUpload(bucket_name, objkey, filePath).then((res) => {
                        //console.log("Success : ", res);
                        resolve(true);
                    }).catch((error)=>{
                        resolve(false);
                    })
                }, 20);
            })
        }));
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant