Error domain nscocoaerrordomain code 512

Based on https://support.apple.com/en-us/HT201372 I tried twice but both also failed at 100% with the following error:

Based on https://support.apple.com/en-us/HT201372 I tried twice but both also failed at 100% with the following error:

sudo /Applications/Install macOS Catalina.app/Contents/Resources/createinstallmedia —volume /Volumes/Catalina 

Password:

Ready to start.

To continue we need to erase the volume at /Volumes/Catalina.

If you wish to continue type (Y) then press return: y

Erasing disk: 0%… 10%… 20%… 30%… 100%

Copying to disk: 0%… 10%… 20%… 30%… 40%… 50%… 60%… 70%… 80%… 90%…

Error: Error Domain=NSCocoaErrorDomain Code=512 «“InstallESD.dmg” couldn’t be copied to “SharedSupport”.» UserInfo={NSSourceFilePathErrorKey=/Applications/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSUserStringVariant=(

    Copy

), NSDestinationFilePath=/Volumes/Install macOS Catalina/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSFilePath=/Applications/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSUnderlyingError=0x7fa9a35bddc0 {Error Domain=NSPOSIXErrorDomain Code=34 «Result too large»}}The copy of the installer app failed

What went wrong ?

For the past, I’ve been using https://diskmakerx.com to create bootable USB without any issue. This time around, DiskMakerX still have not release support for Catalina, thus I have to make use of command line.

  • #1

Hello,
today I wanted to play around a bit with Catalina (downloaded from AppStore) and OpenCore.
So I started creating a new USB Installation media as I did multiple times.
I even installed this machine I am currently posting on, with exactly the same usb drive.
But this thime it failed with the following message, any idea what’s going wrong?

Code:

$ sudo /Applications/Install macOS Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
Ready to start.
To continue we need to erase the volume at /Volumes/MyVolume.
If you wish to continue type (Y) then press return: y
Erasing disk: 0%... 10%... 20%... 30%... 100%
Copying to disk: 0%... 10%... 20%... 30%... 40%... 50%... 60%... 70%... 80%... 90%...
Error: Error Domain=NSCocoaErrorDomain Code=512 "“InstallESD.dmg” couldn’t be copied to “SharedSupport”." UserInfo={NSSourceFilePathErrorKey=/Applications/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSUserStringVariant=(
    Copy
), NSDestinationFilePath=/Volumes/Install macOS Catalina/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSFilePath=/Applications/Install macOS Catalina.app/Contents/SharedSupport/InstallESD.dmg, NSUnderlyingError=0x7fd9496f59d0 {Error Domain=NSPOSIXErrorDomain Code=34 "Result too large"}}The copy of the installer app failed.

I try now with gibmacos

Last edited: Feb 6, 2020

  • #2

OK that’s it , that worked.
Recap:
Downloaded from AppStore don’t work.
downloaded with gibmac works !

Hi @DongQuanRui Thanks for reply , you understood correctly what our app does , As I debugged more , the issue is with file writing API , its happening with more than 400+ user not with all to give a clue all affected user are iOS version 13+

Upload file to S3 by calling uploadData API and the API returns an error with error code 512 , because while writing file to temp directory it fails .
This issue happens only for some users and it does not return error to all the users.Found similar issue on the
apple developer forum.Please find the link for the same below.

https://developer.apple.com/forums/thread/128927

Please find the code snippet below.

(AWSTask<AWSS3TransferUtilityUploadTask *> *)uploadData:(NSData *)data
bucket:(NSString *)bucket
key:(NSString *)key
contentType:(NSString *)contentType
expression:(AWSS3TransferUtilityUploadExpression *)expression
completionHandler:(AWSS3TransferUtilityUploadCompletionHandlerBlock)completionHandler {}
// Saves the data as a file in the temporary directory.
NSString *fileName = [NSString stringWithFormat:@»%@.tmp», [[NSProcessInfo processInfo] globallyUniqueString]];
NSString *filePath = [self.cacheDirectoryPath stringByAppendingPathComponent:fileName];
NSURL *fileURL = [NSURL fileURLWithPath:filePath];

NSError *error = nil;
BOOL result = [data writeToURL:fileURL
options:NSDataWritingAtomic
error:&error];
if (!result) {
if (completionHandler) {
AWSS3TransferUtilityUploadTask *uploadTask = [AWSS3TransferUtilityUploadTask new];
uploadTask.bucket = bucket;
uploadTask.key = key;
completionHandler(uploadTask,error);
}
}
Error :
Error Domain=NSCocoaErrorDomain Code=512 “The file couldn’t be saved.” UserInfo={NSUserStringVariant=Folder}

TLDR: On my three attempts of creating a bootable flash drive, I keep getting an error «error domain=nscocoaerrordomain code=512». The flash drive I am using is a 16GB drive. Google said it’s possible that the installer is corrupted or the flash drive is too small. I’m looking for possible options before moving again since it takes a lot of time to do things on the VM.

Long version:

So, I set up a VM running Catalina on my Windows 10 host. I downloaded the Catalina installer.app from the Apple Store, and ran the createinstallmedia command on terminal. I don’t have the original error message anymore, but what I found from my search history earlier my error was «error domain=nscocoaerrordomain code=512 localizable.strings». I tried the createinstall media three times, and it gave me that error every time. Only on my last attempt the file in question was x.dmg (I forgot the name of the actual file). Whenever that error occurs, my flash drive no longer shows up in Disk Utility, and only shows up when I restart my VM, and when it does show up it says the flash drive is full (occupies 14GB of space).

Google didn’t have an answer for me regarding this error. Of the four instances I found this error online, two were unanswered, and one answer said the flash drive size maybe too small. The other answer said the installer might’ve been corrupted, and suggested re-downloading. I would love to re-download, although my flash drive is apparently bricked now. It won’t show up on my device manager in the host and not showing up on other computers as well, but that’s not my concern.

So for the two possible answers I found, here are my issues regarding each one.

  1. The flash drive maybe too small — those answers are for people who used 8GB drives. I’m using a 16GB drive.

  2. The installer may be corrupted — this I have not considered. I would love to try re-downloading it again. What’s stopping me is that the downloads take too long in my VM, and I don’t want to try it again unless I am out of options.

Since my only 16GB drive is bricked, I ordered a brand new 32GB one that may arrive tomorrow or the next day. I know this post seems all over the place, but I’m just trying to comply with being as detailed as possible since I don’t have the full error anymore. If anyone knows any possible cause or solution to my error, I would gladly appreciate it.

Here are the specs of my PC:

Intel i7-4770

GTX 1050TI

8GB DDR3

Any help would be appreciated. Thanks!

EDIT: I have done more research and I think it’s because I’m using a 3.0 USB. is that it??

Hey Team,

We are seeing some random crashes for CoreData only on iOS 9 devices. We are primarily seeing two errors when Core Data performs lightweight migration when setting up the Stack —

We have no clue about what this error could be

"Error Domain=NSCocoaErrorDomain Code=512 "The file couldnU2019t be saved."

2. The error code translates to SQLite Error code 14. [Error code is «Domain=NSCocoaErrorDomain Code=134110», «NSSQLiteErrorDomain Code=14» https://developer.apple.com/library/mac/documentation/Cocoa/Reference/CoreDataFramework/Miscellaneous/CoreData_Constants/#//apple_ref/doc/constant_group/Migration_Error_Codes , https://www.sqlite.org/rescode.html#cantopen ]

Error Domain=NSCocoaErrorDomain Code=134110 "An error occurred during persistent store migration." UserInfo=
{  sourceURL=file:///var/mobile/Containers/Data/Application/BFD91E93-5977-4135-A454-5EBDF8EE53E4/Library/Database/DB.sqlite,
reason=Can't copy source store to destination store path, destinationURL=file:///var/mobile/Containers/Data/Application/BFD91E93-5977-4135-A454-5EBDF8EE53E4/Library/Database/.DB.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3,
NSUnderlyingError=0x127fd31e0 {Error Domain=NSSQLiteErrorDomain Code=14 "(null)"
UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/BFD91E93-5977-4135-A454-5EBDF8EE53E4/Library/Database/.DB.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3,


reason=Failed to open destination database}}}";

We don’t know what could be causing these issues. Also, the directory being protected via «NSFileProtectionComplete» option does not seem to be setup right.

Some additional datapoints that we have from Crashlytics —

1. This crash happens only on iOS 9 devices

2. Almost 70-80% of the times, the user has low RAM

3. We are not able to reproduce this migration issue on our test devices

4. We dropped support for «Vaccum option» for the latest version where we are seeing the crashes

5. We are logging the metadata and noticed that the NSPersistenceFrameworkVersion also changed from 640 to 641 from our last version of the app

We would really appreciate any help/pointers in how to fix this issue. Thanks!

Snippet from CoreData stack setup is as below —

# pragma mark - Core Data Stack Setup
- (NSManagedObjectContext *)getMainContext{

    NSManagedObjectContext *managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
    [managedObjectContext setUndoManager:nil];
    [managedObjectContext setPersistentStoreCoordinator:[self getPersistentStoreCoordinator]];
    [managedObjectContext setMergePolicy:NSMergeByPropertyStoreTrumpMergePolicy];
    return managedObjectContext;
}
- (NSPersistentStoreCoordinator*)getPersistentStoreCoordinator{

    NSPersistentStoreCoordinator *persistentStoreCoordinator = nil;

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Model" ofType:@"momd"];
    NSManagedObjectModel *objectModel = [[NSManagedObjectModel alloc]
                                         initWithContentsOfURL:[NSURL fileURLWithPath:path]];
    NSDictionary *storeOptions =  @{ NSMigratePersistentStoresAutomaticallyOption: @YES,
                                     NSInferMappingModelAutomaticallyOption: @YES };
    NSError *error = nil;

    persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:objectModel];
    NSPersistentStore *persistentStore = [persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
                                                                                  configuration:nil
                                                                                            URL:[self storeURL]
                                                                                        options:storeOptions
                                                                                          error:&error];
    if (!persistentStore) {
        NSLog(@"error: %@", error);
    }

    return persistentStoreCoordinator;
}
-(NSURL *)storeURL{

    NSString *databaseFileName = @"DB.sqlite";
    NSString *appDatabaseFilePath = [[self sharedDatabasePath] stringByAppendingPathComponent:databaseFileName];
    return [NSURL fileURLWithPath:appDatabaseFilePath];
}
- (NSString *)sharedDatabasePath{

    NSString *sharedDocumentsPath = nil;
    NSString *libraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    sharedDocumentsPath = [libraryPath stringByAppendingPathComponent:@"Database"] ;

    NSFileManager *manager = [NSFileManager defaultManager];
    BOOL isDirectory;
    if (![manager fileExistsAtPath:sharedDocumentsPath isDirectory:&isDirectory] || !isDirectory) {
        NSError *error = nil;
        NSDictionary *attr = [NSDictionary dictionaryWithObject:NSFileProtectionComplete
                                                         forKey:NSFileProtectionKey];
        [manager createDirectoryAtPath:sharedDocumentsPath
           withIntermediateDirectories:YES
                            attributes:attr
                                 error:&error];
        if (error)
            NSLog(@"Error creating directory path: %@", [error localizedDescription]);
    }

    return sharedDocumentsPath;
}

Когда я копирую файл из локального приложения в iCloud, файл копируется, но я получаю эту ошибку: Error Domain = NSCocoaErrorDomain Code = 512 «Операция не может быть завершена. (Ошибка Cocoa 512.)»

Вот код

NSString *source = [tagsPath stringByAppendingPathComponent:current_Group_Name];
source = [source stringByAppendingPathComponent:fileName];

NSURL *sourceURL = [NSURL fileURLWithPath:source];

dispatch_queue_t q_default;
q_default = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(q_default, ^(void) {

    fileManager = [NSFileManager defaultManager];

    NSURL *ubiq = [fileManager URLForUbiquityContainerIdentifier:nil];
    if (ubiq) {
        NSURL *groupURL = [tagsURL URLByAppendingPathComponent:current_Group_Name];
        NSError *error= nil;
        NSURL *destinationURL = [groupURL URLByAppendingPathComponent:fileName];

        [fileManager setUbiquitous:YES
                     itemAtURL:sourceURL
                     destinationURL:destinationURL
                     error:&error];
                if (error != nil)
                { NSLog( @"Error > %@",error);
                 [self displayError:NSLocalizedString(@"XMP file not saved in iCloud.", @"") withReason:[NSString stringWithFormat:@"%@%d",NSLocalizedString(@"Error code : ", @""),[error code]]];}

    dispatch_queue_t q_main = dispatch_get_main_queue();
    dispatch_async(q_main, ^(void) {
    });
});

Какие-либо предложения ?

Спасибо

2 ответы

это происходит только для меня на устройствах IOS6, странно то, что на самом деле это кажется сохранением, когда я загружаю данные сохранения, единственная проблема заключается в том, что если я удаляю приложение, а затем загружаю его повторно, оно, кажется, стирает данные icloud

ответ дан 12 окт ’12, 15:10

Я также использую тот же код

setUbiquitous:YES
                 itemAtURL:sourceURL
                 destinationURL:destinationURL
                 error:&error];

для перемещения файла в iCloud, и в то время я также получил ту же ошибку, но я, наконец, решил это небольшим изменением в коде, подобном этому

[[[NSFileManager alloc]init]setUbiquitous:YES itemAtURL:ubiquitousPackage destinationURL:localurl2 error:&error];

Создан 10 июля ’13, 07:07

Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками

ios
icloud

or задайте свой вопрос.

#iphone #ios #cocoa-touch

#iPhone #iOS #прикосновение какао

Вопрос:

Я пытаюсь просто скопировать свою базу данных sqlite3 в каталог documents. Я получаю Cocoa Error 512 , и я понял, что это недопустимый каталог (или что-то в этом роде.

Файл базы данных находится в папке «Мои ресурсы» в XCode. (Имя файла указано правильно)

Вот код, который я пытаюсь использовать:

 -(void) checkAndCreateDatabase
{
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [documentPaths objectAtIndex:0];

    //databasePath   databaseName is declared in the header
    databaseName = @"WaypointDatabase.sql";
    databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

    success = [fileManager fileExistsAtPath:databasePath];
if(success)
    {
        NSLog(@"Database exists");
            return;
    }
    else
        NSLog(@"Database does not exists");

    NSString *databasePathFromApp = [[NSBundle mainBundle] pathForResource:@"WaypointDatabase" ofType:@"sql"];
    if(databasePathFromApp == nil)
    {
        NSLog(@"ERROR: IT IS NIL");
    }
    NSError* error = nil;

    NSLog(@"Path in bundle:n%@nn", databasePathFromApp);
    NSLog(@"Path to copy to:n%@nn", databasePath);

    [fileManager copyItemAtPath:databasePathFromApp
                     toPath:databasePath error:amp;error];
    [fileManager release];
    if (error)
    {
        NSLog(@"%@nn", error);
        NSLog(@"%@", [error userInfo]);
    }
}
 

И вывод на консоль, который я получаю,:

2011-10-30 10:36:13.242 xxxx[6726:707] База данных не существует
2011-10-30 10:36:13.249 xxxx[6726:707] Путь в пакете:
/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/xxxx.app/WaypointDatabase.sql

2011-10-30 10:36:13.252 xxxx[6726:707] Путь для копирования:
/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/Documents/WaypointDatabase.sql

2011-10-30 10:36:13.268 xxxx[6726:707] Ошибка Domain= NSCocoaErrorDomain Code= 512 «Не удалось завершить операцию. (Ошибка Cocoa 512.)» userInfo=0xe8b7cd0 {NSUserStringVariant=(Копировать), NSFilePath=/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/xxxx.app/WaypointDatabase.sql , NSDestinationFilePath=/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/Documents/WaypointDatabase.sql, NSUnderlyingError=0xe8b7ee0 «Не удалось завершить операцию. Не каталог «}

2011-10-30 10:36:13.272 xxxx[6726:707] { NSDestinationFilePath = «/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/Documents/WaypointDatabase.sql»; NSFilePath = «/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/xxxx.app/WaypointDatabase.sql»; NSUnderlyingError = «Ошибка домена = NSPOSIXErrorDomain Code = 20″Операция не может быть завершена. Не каталог «»; NSUserStringVariant = ( Копировать ); }

Я полагаю, это должно быть связано с получением путей к каталогам или чем-то еще, но я застрял на этом уже несколько дней.

Обратите внимание, это работает отлично и без каких-либо ошибок на симуляторе.

Где я мог ошибиться?

[ОБНОВЛЕНИЕ]

Может быть, это связано Documents с тем, что каталог -folder не существует? Как бы мне приступить к его созданию / проверке?

[ОБНОВЛЕНИЕ 2]

Я провел несколько других тестов, используя

 NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *err = nil;
NSArray *dirArr = [fileManager contentsOfDirectoryAtPath:documentsDir error:amp;err];
NSLog(@"~~Contents:n%@",dirArr);
NSLog(@"~~Error: n%@",err);
 

И, что удивительно, он дал Cocoa Error 256 , а также сказал «Не каталог». Это почти так же, как если Documents directory does not exist. But it does, according to бы NSSearchPathForDirectoriesInDomains`

Вот результат, который я получил

2011-10-30 10:59:16.934 xxxx[6774:707] ~~ Содержимое:
(null)
2011-10-30 10:59:16.936 xxxx[6774:707] ~~ Ошибка:
Ошибка домена = NSCocoaErrorDomain Code= 256 «Операция не может быть завершена. (Ошибка Cocoa 256.)» userInfo=0x10052580 {NSUserStringVariant=( Папка ), NSFilePath=/var/mobile/Applications/FF654016-4257-47BB-99FE-55DB5453BBC6/Documents, NSUnderlyingError= 0x10054a50 «Не удалось завершить операцию. Не каталог «}

Комментарии:

1. вы не должны выпускать FileManager, он автоматически выпускается

2. @phix23, опубликуйте это в документации, так что я думаю, что было бы лучше сделать это.

3. Вы не должны выпускать его, потому что вы его не выделили. Что такое DatabasePath? Разве не должно быть так, что вы создаете из documentsDir и DatabaseName несколько строк сверх этого?

4. @Nideo это ужасная причина для того, чтобы что-то делать. Придерживайтесь правил управления памятью, если вы не вызываете alloc new ее или copy она вам не принадлежит, поэтому не освобождайте ее

5. @Paul.s — я только что с Явы…

Ответ №1:

Проблема была решена путем установки нестандартного идентификатора пакета в die info.plist

Я использовал идентификатор пакета из iTunes Connect для этого конкретного приложения. Теперь все работает отлично.

Ответ №2:

Попробуйте измениться

 [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];
 

для

 [[NSBundle mainBundle] pathForResource:@"WaypointDatabase" ofType:@"sql"];
 

и убедитесь, что это не возвращается nil , чтобы убедиться, что это не то, что происходит не так, кроме того, что при первом просмотре мне кажется, что все в порядке.

Комментарии:

1. Я попробовал это, а также поставил a if , чтобы проверить, есть ли результат этого nil — чего не было. Обычная ошибка все еще возникает.

Понравилась статья? Поделить с друзьями:
  • Error document is not defined no undef
  • Error document follows
  • Error docker exporter does not currently support exporting manifest lists
  • Error do not access object prototype method hasownproperty from target object no prototype builtins
  • Error dmg image is corrupted