ちょっと、私のAndroidアプリで以下のコードを使用しています。それはkinveyサーバー上の画像をアップロードしています。しかし、ファイルコレクションの下のkinveyにあるダウンロードリンクhttp://storage.googleapis.com/6e1e6118eb264d42902a4b280cd5aa7b/myFile/abc.jpgを使ってファイルを開くと、「このXMLファイルには関連するスタイル情報は表示されません。以下。kinveyサーバーで画像をアップロードしてダウンロードするには
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
</Error>
と私は、そのファイルをダウンロードしようとすると、それはブロブが見つからない問題がどこにあるか私にはわからない、あなたはそれを指摘してください可能性を示し、私は下のダウンロードのログを与えています。.. ...これは私の画像アップロードコード事前
で おかげで
public void upload()
{
try{
File file = new File(""+Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)+"/aa.jpg");
FileMetaData metadata = new FileMetaData("myFile");
// metadata.setAcl((new KinveyMetaData()).AccessControlList().setGloballyReadable(true)); //create the FileMetaData object
metadata.setPublic(true); //set the file to be pubicly accesible
// metadata.setAcl((new KinveyMetaData.AccessControlList()).setGloballyReadable(true)); //allow all users to see this file
metadata.setFileName("abc.jpg");
FileInputStream fin=new FileInputStream(file);
UploaderProgressListener upl=new UploaderProgressListener() {
@Override
public void onSuccess(Void result) {
System.out.println("upload success!");
}
@Override
public void onFailure(Throwable error) {
System.out.println("upload progress change!");
}
@Override
public void progressChanged(MediaHttpUploader uploader) throws IOException {
System.out.println("upload progress change -> " + uploader.getUploadState());
}
};
mKinveyClient.file().upload(metadata,fin,upl);
}catch(Exception e){
System.out.println("Couldn't upload! -> " + e);
e.printStackTrace();
}
}
これは......、ダウンロードするために私は、ログを確認してください「ブロブが見つからない」しまった画像コードをダウンロードするためのコード
public void download() {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/aa11.jpg");
try {
FileOutputStream fos = new FileOutputStream(file);
DownloaderProgressListener dpl=new DownloaderProgressListener() {
@Override
public void progressChanged(MediaHttpDownloader mediaHttpDownloader) throws IOException {
System.out.println("progress updated: "+mediaHttpDownloader.getDownloadState());
}
@Override
public void onSuccess(Void aVoid) {
System.out.println("successfully download file");
}
@Override
public void onFailure(Throwable throwable) {
// System.out.println("failed to download file :->"+throwable.getCause());
System.out.println("failed to download file :->"+throwable.getLocalizedMessage());
System.out.println("failed to download file :->"+throwable.getStackTrace());
}
};
Query myQuery=new Query();
myQuery.equals("id","myFile");
client.file().download(myQuery,fos,dpl);
}catch(Exception e)
{
System.out.println("in catch block,could'nt download file ---->"+e.getMessage());
}
}
ログをダウンロードし、私のイメージです....
16:09:46.036 13008-13008/com.kinvey.sample.statusshare I/System.out: aa1.jpgで新しいファイルをダウンロードします 11-02 16:09:46.051 13008-13341/com.kinvey.sample .statusshare I/System.out:更新済み:DOWNLOAD_IN_PROGRESS 11-02 16:09:46.051 13008-13341/com.kinvey.sample.status共有I/System.out:更新済み:INITIATION_STARTED 11-02 16:09:46.870 13008-13341/com.kinvey.sample.statusshare I/System.out:ファイルのダウンロードに失敗しました: - > 11-02 16: 09:46.870 13008-13341/com.kinvey.sample.statusshare I/System.out:理由:BlobNotFound 11-02 16:09:46.870 13008-13341/com.kinvey.sample.statusshare I/System.out:FIX :このアプリのバックエンドで見つからないブロブ 11-02 16:09:46.870 13008-13341/com.kinvey.sample.statusshare I/System.out:説明: ダウンロード中のファイルが存在しません。 11-02 16:09:46.890 13008から13341/com.kinvey.sample.statusshare I /のSystem.out: ダウンロードファイルに失敗しました: - > [Ljava.lang.StackTraceElement; 33e9dd19
私はそれがファイルのダウンロード時にこの問題を示しているAndroidのSDK 22毎回を使用しています。ファイルのアップロードは正常です。アップロード処理中にエラーは発生しません。 –