Thư mục Drive iCloud không hiển thị thư mục của ứng dụng của tôi.Tại sao ứng dụng của tôi không được hiển thị trong Thư mục Drive iCloud
Đây là cách tôi gửi một tập tin vào iCloud Drive:
- (IBAction)btnStoreTapped:(id)sender {
// Let's get the root directory for storing the file on iCloud Drive
[self rootDirectoryForICloud:^(NSURL *ubiquityURL) {
NSLog(@"1. ubiquityURL = %@", ubiquityURL);
if (ubiquityURL) {
// We also need the 'local' URL to the file we want to store
//NSURL *localURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Photo" ofType:@"pdf"]];
NSURL *localURL = [self localPathForResource:@"document" ofType:@"doc"];
NSLog(@"2. localURL = %@", localURL);
// Now, append the local filename to the ubiquityURL
ubiquityURL = [ubiquityURL URLByAppendingPathComponent:localURL.lastPathComponent];
NSLog(@"3. ubiquityURL = %@", ubiquityURL);
// And finish up the 'store' action
NSError *error;
if (![[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:localURL destinationURL:ubiquityURL error:&error]) {
NSLog(@"Error occurred: %@", error);
}else{
NSLog(@"Succeed");
}
}
else {
NSLog(@"Could not retrieve a ubiquityURL");
}
}];
}
- (void)rootDirectoryForICloud:(void (^)(NSURL *))completionHandler {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSURL *rootDirectory = [[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]URLByAppendingPathComponent:@"Documents"];
if (rootDirectory) {
if (![[NSFileManager defaultManager] fileExistsAtPath:rootDirectory.path isDirectory:nil]) {
NSLog(@"Create directory");
[[NSFileManager defaultManager] createDirectoryAtURL:rootDirectory withIntermediateDirectories:YES attributes:nil error:nil];
}
}
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(rootDirectory);
});
});
}
- (NSURL *)localPathForResource:(NSString *)resource ofType:(NSString *)type {
NSString *documentsDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
NSString *resourcePath = [[documentsDirectory stringByAppendingPathComponent:resource] stringByAppendingPathExtension:type];
return [NSURL fileURLWithPath:resourcePath];
}
Trên thực tế tôi đã làm everyting giải thích in this post
Mọi thứ trông giống như tốt. Tôi có thể tải lên tệp thành công và tôi có thể hiển thị chúng trong máy tính của mình qua thiết bị đầu cuối.
Và tôi có thể xem các tập tin tôi chỉ được tải lên từ iphone của tôi.
Nhưng không có gì được hiển thị trong thư mục iCloud Drive trong mac hoặc icloud.com của tôi. Tại sao họ không hiển thị thư mục của ứng dụng của tôi, ngay cả mọi thứ có vẻ ổn và không có lỗi?
Tôi dường như đã từ chối tuyên bố của bạn rằng 'NSUbiquitousContainerIsDocumentScopePublic = true chỉ có hiệu lực sau khi ứng dụng (và vùng chứa iCloud có quyền) đã được xem xét và phê duyệt'. Với ứng dụng cửa hàng ứng dụng hiện tại, không có khóa NSUbiquitousContainers nào trong danh sách. Tôi đã thêm NSUbiquitousContainerIsDocumentScopePublic = true, và nhấn CFBundleVersion mà không cần gửi tới kho ứng dụng - và vùng chứa phổ biến sẽ hiển thị trong ứng dụng iCloud Drive iOS ** và ** vùng chứa sẽ hiển thị trên hệ thống OS X được đăng nhập vào cùng tài khoản iCloud (I thậm chí không đồng bộ một tệp). –
Tôi đồng ý @Michael Rourke. Nó không có liên quan gì đến App Store. Điều gì đã khắc phục sự cố cho tôi là nhận được ID ứng dụng mới theo http://stackoverflow.com/questions/25203697/exposing-an-apps-ubiquitous-container-to-icloud-drive-in-ios-8/32801479#32801479 . Ứng dụng của tôi chưa có trong App Store. Bạn cần có NSUbiquitousContainerIsDocumentScopePublic = true trong Info.plist trước khi bạn chạy ứng dụng lần đầu tiên. – BillF
Tôi đã gặp sự cố tương tự này. Ứng dụng của tôi đã tồn tại trong cửa hàng ứng dụng, vì vậy tôi không thể làm gì để thư mục ứng dụng hiển thị trong iCloud Drive. Tôi thậm chí đã gỡ cài đặt ứng dụng và cài đặt lại, và nó không hiển thị. – gbotha