I have these two errors. I developed a program that works in 10.10 but plant 10.7. I did not test in 10.8 and 10.9. How to correct the problem. I use these two methods for authentication and for something else. How to do ? Rewrite everything? Thank you
Errors :
2015-09-29 10:32:47.320 PROG[1175:707] -[NSConcreteMutableData base64EncodedStringWithOptions:]: unrecognized selector sent to instance 0x7fd209e1c6b0 2015-09-29 10:32:47.321 PROG[1175:707] An uncaught exception was raised 2015-09-29 10:32:47.322 PROG[1175:707] -[NSConcreteMutableData base64EncodedStringWithOptions:]: unrecognized selector sent to instance 0x7fd209e1c6b0 2015-09-29 10:32:47.326 PROG[1175:707] ( 0 CoreFoundation
0x00007fff9158af56 exceptionPreprocess + 198 1 libobjc.A.dylib
0x00007fff8b305d5e objc_exception_throw + 43 2 CoreFoundation
0x00007fff916171be -[NSObject doesNotRecognizeSelector:] + 190 3
CoreFoundation 0x00007fff91577e23 ___forwarding_ + 371 4 CoreFoundation 0x00007fff91577c38 _CF_forwarding_prep_0 + 232 5 PROG
0x000000010dd8fc20 -[AppDelegate awakeFromNib] + 1056 6
CoreFoundation 0x00007fff91581fb1 -[NSObject performSelector:] + 49 7 CoreFoundation
0x00007fff91581f32 -[NSSet makeObjectsPerformSelector:] + 274 8
AppKit 0x00007fff86eee347 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1245 9 AppKit 0x00007fff86ee48bb loadNib + 322 10 AppKit 0x00007fff86ee3db8 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217 11 AppKit 0x00007fff86ee3cd3 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141 12 AppKit 0x00007fff86ee3c16 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364 13 AppKit 0x00007fff87154cd7 NSApplicationMain + 398 14 PROG
0x000000010dd8f7f2 main + 34 15 PROG
0x000000010dd8f7c4 start + 52 16 ???
0x0000000000000001 0x0 + 1 ) 2015-09-29 10:32:47.326 PROG[1175:707] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData base64EncodedStringWithOptions:]: unrecognized selector sent to instance 0x7fd209e1c6b0' * First throw call stack: ( 0 CoreFoundation 0x00007fff9158af56 exceptionPreprocess + 198 1 libobjc.A.dylib
0x00007fff8b305d5e objc_exception_throw + 43 2 CoreFoundation
0x00007fff916171be -[NSObject doesNotRecognizeSelector:] + 190 3
CoreFoundation 0x00007fff91577e23 ___forwarding_ + 371 4 CoreFoundation 0x00007fff91577c38 _CF_forwarding_prep_0 + 232 5 PROG
0x000000010dd8fc20 -[AppDelegate awakeFromNib] + 1056 6
CoreFoundation 0x00007fff91581fb1 -[NSObject performSelector:] + 49 7 CoreFoundation
0x00007fff91581f32 -[NSSet makeObjectsPerformSelector:] + 274 8
AppKit 0x00007fff86eee347 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1245 9 AppKit 0x00007fff86ee48bb loadNib + 322 10 AppKit 0x00007fff86ee3db8 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217 11 AppKit 0x00007fff86ee3cd3 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141 12 AppKit 0x00007fff86ee3c16 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364 13 AppKit 0x00007fff87154cd7 NSApplicationMain + 398 14 PROG
0x000000010dd8f7f2 main + 34 15 PROG
0x000000010dd8f7c4 start + 52 16 ???
0x0000000000000001 0x0 + 1 )
Thanks for your help ... and xhruso00 I do not know if I should change my question here and write a new answer ? Thank you
With
#import <Foundation/Foundation.h>
@interface NSString (NSStringExtension)
- (id) base64EncodedStringWithOptions:(NSString *)string;
- (NSString *) base64Encoding;
- (NSString *)mh_base64String;
@end
and
#import "NSStringExtension.h"
@implementation NSString (NSStringExtension)
NSUInteger NSAppKitVersionNumber10_8;
NSUInteger NSAppKitVersionNumber;
- (NSString *)mh_base64String
{
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_8) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [self base64Encoding];
#pragma clang diagnostic pop
}
else {
return [self base64EncodedStringWithOptions:0];
}
}
@end
and
in the main
@implementation AppDelegate
...
//NSString *authenticationValue = [authenticationData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
NSString *authenticationValue = [authenticationData mh_base64String];
...
@end
I have one error:
AppDelegate.m:56:57: error: no visible @interface for 'NSData' declares the selector 'mh_base64String' NSString *authenticationValue = [authenticationData mh_base64String];
i have two warning :
method definition for 'base64EncodedStringWithOptions:' not found
method definition for 'base64EncodedStringWithOptions:' not found
is it correct ?
What is the problem ?
Thanks