Skip navigation.
 
mlRe: NSString subStringToIndex gives EXC_BAD_ACCESS
FROM : John Stiles
DATE : Fri Nov 09 23:51:37 2007

You didn't alloc projectName.

On Nov 9, 2007, at 2:45 PM, Gregor Brandt wrote:

> The following code snippet compiles fine but gives an bad access 
> error on run....any ideas
>
>
>      NSString *projectName;
>      NSString *title = @"This is a test";
>
>      // and parse the project name to remove the [TM] from the end
>      NSUInteger realLength = title.length - 4;
>      if ( realLength > 0 )
>      {
>          [projectName initWithString:[title 
> substringToIndex:realLength]];
>      }
>
>
> Thanks
>
> Gregor
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
> 40blizzard.com
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlNSString subStringToIndex gives EXC_BAD_ACCESS Gregor Brandt Nov 9, 23:45
mlRe: NSString subStringToIndex gives EXC_BAD_ACCESS John Stiles Nov 9, 23:51
mlRe: NSString subStringToIndex gives EXC_BAD_ACCESS I. Savant Nov 9, 23:52
mlRe: NSString subStringToIndex gives EXC_BAD_ACCESS Gregor Brandt Nov 9, 23:56