What is wrong with this I am getting EXEC_BAD
self.allLessonsArray = [NSArray arrayWithObjects: [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects:@"Title", @"Description", @"LessonID", @"LessonSuffix", @"LibraryImage", @"Price", @"IsFree", nil] forKeys: [NSArray arrayWithObjects: @"First Lesson", @"This is a test description of our first lesson, this lesson is just a copy of Sample StoryApp which we will replace with our first Color Lesson for Very Small Kids. Design of that lesson is still to be discussed with our designer.", 1, @"Less1", @"LibLess1Image.jpg", 0, 1, nil]], [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects:@"Title", @"Description", @"LessonID", @"LessonSuffix", @"LibraryImage", @"Price", @"IsFree", nil] forKeys: [NSArray arrayWithObjects: @"Second Lesson", @"I want to give some description to this title but its so time consuming and boring to write. So here i go - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 2, @"Less2", @"LibLess2Image.png", 0.99, 0, nil]], nil];
Formatted:
self.allLessonsArray = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:
@"Title",
@"Description",
@"LessonID",
@"LessonSuffix",
@"LibraryImage",
@"Price",
@"IsFree",
nil]
forKeys:
[NSArray arrayWithObjects:
@"First Lesson",
@"This is a test description of our first lesson, this lesson is just a copy of Sample StoryApp which we will replace with our first Color Lesson for Very Small Kids. Design of that lesson is still to be discussed with our designer.",
1,
@"Less1",
@"LibLess1Image.jpg",
0,
1,
nil]
],
[NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:
@"Title",
@"Description",
@"LessonID",
@"LessonSuffix",
@"LibraryImage",
@"Price",
@"IsFree",
nil]
forKeys:
[NSArray arrayWithObjects:
@"Second Lesson",
@"I want to give some description to this title but its so time consuming and boring to write. So here i go - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
2,
@"Less2",
@"LibLess2Image.png",
0.99,
0,
nil]
],
nil];
NSArrayobjects can only contain objects. Each integer need to be converted to aNSNumber.In particular the second embedded
NSArraycontainswhich should be
Or made strings:
Please break out the embedded
NSArrays andNSDictionaryinto separate statements for readability. More clearly written code would probably make it easier to find errors.Example:
I make a guess at better var names. Also better formatting is possible for the arrays. Notice the elimination of the duplicate
NSArraylessonKeys.Still this might be better in a plist file that is read. That would allow making changes and adding lessons without requiring code changes.