проблема пишущий NSMutableArray в файл в какао

Кажется, вы пропустили ключевое слово await до вызова doLogin():

fixture`App > ${menuName}`
  .page`${HOST}`
  .beforeEach(async (t) => {
    // Don't forget about await
    await doLogin(t)
  });

Из-за деталей реализации в некоторых случаях можно вызвать функцию async без await, но лучше не полагаться на это и всегда использовать await с async функциями.

Если вы добавите ключевое слово async и оно не исправит тест, не стесняйтесь создать отчет об ошибке в репозитории TestCafe и предоставить полный пример, который можно запустить для воспроизведения проблемы. ,

5
задан 15 April 2009 в 10:36
поделиться

1 ответ

NSValues can't be saved in a plist (which is what writeToFile:atomically: does). Take a look here for the values you can save. (NSNumber is a kind of NSValue you can save, but other NSValues will fail.)

If you want to save your array with NSValues, you can use archiving instead of writeToFile:atomically:. NSArray and NSValue both support archiving, so you just convert the array to an archive and save that data to a file. (It will include the NSValues as well.) The code looks something like this:

[NSKeyedArchiver archiveRootObject:myArray toFile:@"myPath"];

To load it, just use:

NSArray *myArray = [NSKeyedUnarchiver unarchiveObjectWithFile:@"myPath"];
15
ответ дан 18 December 2019 в 12:01
поделиться
Другие вопросы по тегам:

Похожие вопросы: