0
간단히이 이미지를 iCloud에 업로드하려고합니다. 그것은 나에게 "작업을 완료 할 수 없습니다. 작업이 허용되지 않습니다."라는 오류를 계속 제공합니다. 이 코드를 Document Based App Programming Guide에서 가져 와서 모든 인증서, 식별자, 프로필 및 권한을 올바르게 설정했다고 생각합니다. 어떤 도움이라도 대단히 감사 할 것입니다. 이것은 매우 실망 스럽습니다.간단히 이미지를 icloud로 보낼 때 "작업을 완료 할 수 없습니다. 작업을 수행 할 수 없습니다"오류가 발생했습니다.
#import "docx.h"
@implementation docx
-(IBAction)test:(id)sender{
NSURL *src = [NSURL URLWithString:@"/Users/rjm226/Desktop/jh.jpg"];
NSLog(@"%@", src);
NSURL *dest = NULL;
NSURL *ubiquityContainerURL = [[[NSFileManager defaultManager]
URLForUbiquityContainerIdentifier:nil]
URLByAppendingPathComponent:@"Documents"];
if (ubiquityContainerURL == nil) {
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"iCloud does not appear to be configured.", @""),
NSLocalizedFailureReasonErrorKey, nil];
NSError *error = [NSError errorWithDomain:@"Application" code:404
userInfo:dict];
[self presentError:error modalForWindow:[self windowForSheet] delegate:nil didPresentSelector:NULL contextInfo:NULL];
return;
}
dest = [ubiquityContainerURL URLByAppendingPathComponent:
[src lastPathComponent]];
//Move file to iCloud
dispatch_queue_t globalQueue =
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(globalQueue, ^(void) {
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSError *error = nil;
// Move the file.
BOOL success = [fileManager setUbiquitous:YES itemAtURL:src
destinationURL:dest error:&error];
dispatch_async(dispatch_get_main_queue(), ^(void) {
if (! success) {
[self presentError:error modalForWindow:[self windowForSheet]
delegate:nil didPresentSelector:NULL contextInfo:NULL];
}
});
});
}
@end
고마워요. 이것은 문제를 해결하지 못했지만 확실히 코드에서 오류가있었습니다. – rjm226