iOS图像不在dropbox上传,但pdf文件在这里上传是我的代码

时间:2015-03-19 08:04:41

标签: ios image dropbox

在IOS中我不知道如何在dropbox上传图像,但我知道如何上传pdf文件,这是我的代码,这是成功上传pdf文件但是当我在dropbox上传图像时它上传但不能看,只有图像名称上传和此错误显示在图像“无法预览此项目”。 请帮帮我......请分享您的宝贵知识......谢谢

- (BOOL)doDropboxTestWithAccount:(DBAccount *)account
{

    if(fileName.length > 0)
    {



        NSString *fileName_get = [NSString stringWithFormat:@"%@",fileName];
        DBError *error = nil;
        DBFilesystem *filesystem = [DBFilesystem sharedFilesystem];
        if (!filesystem) {
            filesystem = [[DBFilesystem alloc] initWithAccount:account];
            [DBFilesystem setSharedFilesystem:filesystem];
        }

        /*
         * Read contents of Dropbox app folder
         */


        /*
         * Check if our test file already exists.
         */

        DBPath *path = [[DBPath root] childPath:fileName_get];

        if (![filesystem fileInfoForPath:path error:&error]) { /* see if path exists */

            /*
             * Report error if path look up failed for some other reason than NOT FOUND
             */

            /*
             * Write a new test file.
             */

            DBFile *file = [[DBFilesystem sharedFilesystem] createFile:path error:&error];
            if (!file)
                return NO;

            if (![file writeString:@"HEllo DropBox" error:&error])
                return NO;
            [file close];

            //[controller append:[NSString stringWithFormat:@"Created new file %@.\n", [path stringValue]]];
        }

        /*
         * Read and print the contents of test file.  Since we're not making
         * any attempt to wait for the latest version, this may print an
         * older cached version.  Use status property of DBFile and/or a
         * listener to check for a new version.
         */

        DBFileInfo *info = [filesystem fileInfoForPath:path error:&error];
        if (!info)
            return NO;

        if ([info isFolder]) {
            //[controller append:[NSString stringWithFormat:@"\n%@ is a folder.\n", [path stringValue]]];
        } else {
            DBFile *file = [[DBFilesystem sharedFilesystem] openFile:path error:&error];
            if (!file)
                return NO;

            NSString *fileContents = [file readString:&error];
            if (!fileContents)
                return NO;
            [file close];
            //[controller append:[NSString stringWithFormat:@"\nRead file %@ and got data:\n    %@",
            //                   [path stringValue], fileContents]];
        }
        fileName=@"";
        return YES;
    }else
    {
         return NO;
    }





}

0 个答案:

没有答案