Thanks, the error message would suggest to me it was the other way round but it seems it is just a badly written error message. I assumed because it said "expecting" that is what it wanted to see.
Corrected and message goes away.
One step closer - thanks again.
The two strings are NSMutable strings so why is it complaining?
![]()
spp = (NSMutableString*)[[pan filename] stringByDeletedPathExtension];
Maybe try like this?
Code:spp = (NSMutableString*)[[pan filename] stringByDeletedPathExtension];
As I explained in my initial post you cannot cast in that direction: you cannot cast an instance of one class to an instance of any subclass. You can only cast to superclasses. This is a very basic OO Programming truth.
To be more precise, you can cast all you like, but all it does is lie to the compiler, which means it can't warn you about the errors in your code. If you have an NSString* you can cast it to NSMutableString* but the object itself remains immutable. Calling any method that would try to modify the string will crash.
You can also for example cast an NSView* to an NSDictionary* if you fancy doing that, but the object is still an NSView and trying to call NSDictionary methods will crash (and calling NSView methods won't work because the compiler won't let you).
NSMutableString * newstring = [NSMutableString stringWithString: [[pan filename] stringByDeletedPathExtension]];