gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object creation error


From: Richard Frith-Macdonald
Subject: Re: Object creation error
Date: Sat, 1 Jul 2023 09:40:31 +0100


> NSArray *justSaySay = [NSArray arrayWithObjects:
> @"there's NOBODY know CHINA than me",
> @"there's NOBODY know AMERICAN than me",
> @"there's ANYBODY know GNUSTEP than me"
> ];

This will often crash, so it is probably the cause of your problem.

The +arrayQWithObjects: method requires that the list of objects must be 
terminated.  Otherwise it will try to interpret the contents of the memory 
location after the last object in the list as an object, which will usually 
cause a crash.
The correct code is:


NSArray *justSaySay = [NSArray arrayWithObjects:
@"there's NOBODY know CHINA than me",
@"there's NOBODY know AMERICAN than me",
@"there's ANYBODY know GNUSTEP than me",
nil
];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]