You use the following lifetime qualifiers for variables just like you would, say, const.
__strong
__weak
__unsafe_unretained
__autoreleasing
- __strong is the default. An object remains “alive” as long as there is a strong pointer to it.
| This is the code path that changed the status bar orientation on iOS 7: | |
| * thread #1: tid = 0x698dbf, 0x00085830 WindowRotationIssue`-[AppDelegate application:willChangeStatusBarOrientation:duration:](self=0x7a041f90, _cmd=0x0137a18d, application=0x79e39cc0, newStatusBarOrientation=UIInterfaceOrientationPortraitUpsideDown, duration=0.80000000000000004) + 96 at AppDelegate.m:23, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1 | |
| * frame #0: 0x00085830 WindowRotationIssue`-[AppDelegate application:willChangeStatusBarOrientation:duration:](self=0x7a041f90, _cmd=0x0137a18d, application=0x79e39cc0, newStatusBarOrientation=UIInterfaceOrientationPortraitUpsideDown, duration=0.80000000000000004) + 96 at AppDelegate.m:23 | |
| frame #1: 0x00bb6ab5 UIKit`-[UIApplication setStatusBarOrientation:animationParameters:notifySpringBoardAndFence:] + 242 | |
| frame #2: 0x00bfa8e4 UIKit`-[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 4761 | |
| frame #3: 0x00bf9646 UIKit`-[UIWi |
| typedef enum _UIBackgroundStyle { | |
| UIBackgroundStyleDefault, | |
| UIBackgroundStyleTransparent, | |
| UIBackgroundStyleLightBlur, | |
| UIBackgroundStyleDarkBlur, | |
| UIBackgroundStyleDarkTranslucent | |
| } UIBackgroundStyle; | |
| @interface UIApplication (UIBackgroundStyle) | |
| -(void)_setBackgroundStyle:(UIBackgroundStyle)style; |
As Apple's Official Doc said:
-viewDidUnloadis deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.
Meanwhile, it's better to remove all -viewDidUnload implements from projects that the deployment target is iOS 6.0 or later. But removing it one by one is boring, especially you've hundreds of controllers & several projects.
So, is there any script or command can do this batch job?
| #!/usr/bin/ruby | |
| input = STDIN.read | |
| subs = { | |
| " " => " ", | |
| "a" => "ɐ", | |
| "b" => "q", | |
| "c" => "ɔ", | |
| "d" => "p", |
| static NSInteger NSJSONReadingFuckNSNulls = (1UL << 3); | |
| @implementation NSJSONSerialization (FuckNulls) | |
| + (void)load { | |
| Method originalMethod = class_getClassMethod(self, @selector(JSONObjectWithData:options:error:)); | |
| IMP swizzledImplementation = imp_implementationWithBlock([^id (id _self, NSData *_data, NSJSONReadingOptions _opt, NSError **_error){ | |
| NSInputStream *stream = [NSInputStream inputStreamWithData:_data]; | |
| [stream open]; | |
| ######################### | |
| # .gitignore file for Xcode4 and Xcode5 Source projects | |
| # | |
| # Apple bugs, waiting for Apple to fix/respond: | |
| # | |
| # 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation? | |
| # | |
| # Version 2.6 | |
| # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
| # |
| #include <sys/xattr.h> | |
| /// Set a flag that the files shouldn't be backuped to iCloud. | |
| + (void)addSkipBackupAttributeToFile:(NSString *)filePath { | |
| u_int8_t b = 1; | |
| setxattr([filePath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); | |
| } | |
| /// Returns the legacy storage path, used when the com.apple.MobileBackup file attribute is not available. | |
| + (NSString *)legacyStoragePath { |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| // Override point for customization after application launch. | |
| // Create a new window and assign directly to provided iVar | |
| _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
| // Implementation of new init method | |
| MyCustomNavigationBar *navigationBar = [[MyCustomNavigationBar alloc] initWithFrame:CGRectZero]; | |
| UINavigationController *navigationController = [[UINavigationController alloc] initWithCustomNavigationBar:navigationBar]; |