Can not log in with my Apple ID, always get an “Your session has timed out.” error message.
Could not submit a feedback, the page https://developer.apple.com/contact/submit.php didn’t redirect properly!
Apple, you should do better!
Can not log in with my Apple ID, always get an “Your session has timed out.” error message.
Could not submit a feedback, the page https://developer.apple.com/contact/submit.php didn’t redirect properly!
Apple, you should do better!
KISS – Keep It Simple, Stupid!
The NSJSONSerialization limited top level objects to NSArray and NSDcitionary, but with this tool, you can encode primative objects, such as integer, float, string, array, dictionary to JSON string, and vice verse.
You can decode the json string contains only string to Objective-C object, like "a"
to an NSString, and it works for numbers, 123
will decode to NSNumber.
#import <Foundation/Foundation.h> NSString *json_encode(id obj){ BOOL is_primative = false; if(![obj isKindOfClass:[NSArray class]] && ![obj isKindOfClass:[NSDictionary class]]){ is_primative = true; obj = [NSArray arrayWithObject: obj]; } id data = [NSJSONSerialization dataWithJSONObject:obj options:0 error:nil]; NSError *err = nil; NSString *str = [[NSString alloc] initWithData:data encoding:[NSString defaultCStringEncoding]]; if(err){ return nil; } if(is_primative){ str = [str substringWithRange:NSMakeRange(1, [str length]-2)]; } return str; } id json_decode(NSString *str){ str = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; BOOL is_primative = false; unichar ch = [str characterAtIndex:0]; if(ch == '"' || (ch != '[' && ch != '{')){ is_primative = true; str = [NSString stringWithFormat:@"[%@]", str, nil]; } NSData* data = [str dataUsingEncoding:[NSString defaultCStringEncoding]]; NSError *err = nil; id obj = [NSJSONSerialization JSONObjectWithData:data options:0 error:&err]; if(err){ return nil; } if(is_primative){ obj = [obj objectAtIndex: 0]; } return obj; } int main(int argc, char **argv){ NSArray *arr = [NSArray arrayWithObjects: @"a", @"b", nil]; NSLog(@"%@", json_encode(@"abc")); NSLog(@"%@", json_encode(arr)); NSLog(@"%@", json_decode(@"[1, 2, \"abc\"]")); NSLog(@"%@", json_decode(@"\"abc\"")); NSLog(@"%@", json_decode(@"\"%\"")); return 0; }
A bunch of simpler Objective-C classes and functions(Standard Objective C Library): https://github.com/ideawu/soc
qlmanage -t -s 512 -o ./output_dir file.svg
-s: size in pixel
-o: ouput dir
I happend to run into the situation that my project cannot compile and run, after I checked the “Entitlements” option. The error message is:
"Check dependencies Code Sign error: The identity 'Mac Developer' doesn't match any valid, non-expired certificate/private key pair in the default keychain"
I just to go to the old way to test my App, so I seek for the solution. Here is how I get rid of this error:
You may want to capture(or intercept, detect) the ESC key press in a Cocoa application, capture the ESC key down in Application scope for the whole app, or just in Window scope for some certain windows.
The NSApplicationDelegate is not a subclass of NSResponder, so you can not implement the keyDown: method int app delegate. The NSWindowController is a subclass of NSResponder, you may implement keyDown: method in it, but it will not get invoked when user press the ESC key(with exceptions) and not when user is typing in a text input.
The solution is to use a Event Monitor.