0

아마존을 사용하여 내 애플리케이션 그림을 저장하고 있지만 Amazon Cognito 자격증 명 공급자를 초기화하려고하면 예외가 발생합니다.Amazon Cognito 자격증 명 공급자를 초기화하려고 할 때 null 객체 참조가 발생합니다.

AmazonS3 s3 = new AmazonS3Client(credentialsProvider); 

내가 그것을했다 "credentialsProvider"기능 whice 무엇을한다 : 여기에 초기화 내가 intialized 때 로그가 sharedpref 널 포인터 예외에 관한

// Initialize the Amazon Cognito credentials provider 
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
     this, 
     "someidentity", // Identity pool ID 
     Regions.US_EAST_2 // Region 
); 

답변

0

이 문제가 된 것입니다 내가 위의 위 게시했습니다 그냥 정적 credentialProvider 아마존 제공 "sCredProvider"Util 클래스에서

그래서 기능은 다음과 같습니다은 "UtilAWS3"클래스

희망에서 상속

AmazonS3 s3 = new AmazonS3Client(sCredProvider); 

는이 이상한 문제 :

을 얻을 사람을 도움