From 31bdf0674a0ad8545eece87b0299c1bdd2c5964d Mon Sep 17 00:00:00 2001 From: John Stricker Date: Tue, 24 Mar 2015 09:08:50 -0400 Subject: [PATCH 1/5] possible fix for transitioning while transitioning crash --- .../RZSingleChildContainerViewController.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m index 44f2076..5c95a0d 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m @@ -55,6 +55,8 @@ @interface RZSingleChildContainerViewController () @property (weak, nonatomic) UIViewController *viewControllerOnWhichWeCalledBegin; +@property (copy, nonatomic) RZSingleChildContainerViewControllerCompletionBlock pendingCompletionBlock; + @end @implementation RZSingleChildContainerViewController @@ -164,7 +166,8 @@ - (void)setContentViewController:(UIViewController *)viewController animated:(BO - (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(RZSingleChildContainerViewControllerCompletionBlock)completion { if ( self.isTransitioning ) { - [NSException raise:NSInternalInconsistencyException format:@"%@: Cannot start a transition while a transition is already in place.", [self class]]; + self.pendingCompletionBlock = completion; + return; } __weak __typeof(self) wself = self; @@ -176,6 +179,10 @@ - (void)setContentViewController:(UIViewController *)viewController animated:(BO if ( completion ) { completion(); } + if ( self.pendingCompletionBlock != nil ) { + self.pendingCompletionBlock(); + self.pendingCompletionBlock = nil; + } }; [self performBlockWhenViewLoaded:^{ From 70e6e9cd09fe725efa073d5a15f2a11dd29b6616 Mon Sep 17 00:00:00 2001 From: John Stricker Date: Tue, 24 Mar 2015 10:49:19 -0400 Subject: [PATCH 2/5] added queue to keep track of transition requests added test project to demo --- .../RZSingleChildContainerViewController.h | 11 + .../RZSingleChildContainerViewController.m | 29 +- .../project.pbxproj | 431 ++++++++++++++++++ .../RZSingleChildTransitionBug/AppDelegate.h | 17 + .../RZSingleChildTransitionBug/AppDelegate.m | 68 +++ .../Base.lproj/LaunchScreen.xib | 41 ++ .../AppIcon.appiconset/Contents.json | 38 ++ .../RZSingleChildTransitionBug/Info.plist | 38 ++ .../ViewController.h | 15 + .../ViewController.m | 27 ++ .../RZSingleChildTransitionBug/main.m | 16 + .../Info.plist | 24 + .../RZSingleChildTransitionBugTests.m | 40 ++ Tests/RZUtilsTests.xcodeproj/project.pbxproj | 75 ++- .../AppDelegate.h | 17 + .../AppDelegate.m | 45 ++ .../Base.lproj/LaunchScreen.xib | 41 ++ .../Base.lproj/Main.storyboard | 25 + .../AppIcon.appiconset/Contents.json | 38 ++ .../Info.plist | 40 ++ .../ViewController.h | 15 + .../ViewController.m | 27 ++ .../main.m | 16 + .../Info.plist | 24 + ...hildViewControllerTransitionBugTestTests.m | 40 ++ 25 files changed, 1186 insertions(+), 12 deletions(-) create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug.xcodeproj/project.pbxproj create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.h create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.m create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Base.lproj/LaunchScreen.xib create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Info.plist create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.h create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.m create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/main.m create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/Info.plist create mode 100644 Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/RZSingleChildTransitionBugTests.m create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.h create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.m create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/LaunchScreen.xib create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/Main.storyboard create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Info.plist create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.h create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.m create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/main.m create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/Info.plist create mode 100644 Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/childViewControllerTransitionBugTestTests.m diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h index 010c2c3..2f0281f 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h @@ -81,3 +81,14 @@ typedef void (^RZSingleChildContainerViewControllerCompletionBlock)(void); - (UIView *)childContentContainerView; @end + +@interface RZSingleChildContainerViewControllerQueuedPresentation : NSObject + +@property (copy, nonatomic) RZSingleChildContainerViewControllerCompletionBlock completionBlock; +@property (assign, nonatomic) BOOL animated; +@property (strong, nonatomic) UIViewController *viewController; + +@end + + + diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m index 5c95a0d..a44ff6a 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m @@ -45,6 +45,7 @@ @interface RZSingleChildContainerAlphaTransitioner : NSObject 0 ) { + RZSingleChildContainerViewControllerQueuedPresentation *queuedPresentation = [self.presentationQueue firstObject]; + [self.presentationQueue removeObjectAtIndex:0]; + [self setContentViewController:queuedPresentation.viewController animated:queuedPresentation.animated completion:queuedPresentation.completionBlock]; } }; @@ -384,3 +395,9 @@ - (NSTimeInterval)transitionDuration:(id ) } @end + +@implementation RZSingleChildContainerViewControllerQueuedPresentation + +@end + + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug.xcodeproj/project.pbxproj b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6a0c475 --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug.xcodeproj/project.pbxproj @@ -0,0 +1,431 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8A5A07471AC1A0DF00C6F7DF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A5A07461AC1A0DF00C6F7DF /* main.m */; }; + 8A5A074A1AC1A0DF00C6F7DF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A5A07491AC1A0DF00C6F7DF /* AppDelegate.m */; }; + 8A5A074D1AC1A0DF00C6F7DF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A5A074C1AC1A0DF00C6F7DF /* ViewController.m */; }; + 8A5A07521AC1A0DF00C6F7DF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8A5A07511AC1A0DF00C6F7DF /* Images.xcassets */; }; + 8A5A07551AC1A0DF00C6F7DF /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8A5A07531AC1A0DF00C6F7DF /* LaunchScreen.xib */; }; + 8A5A07611AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A5A07601AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.m */; }; + 8A5A077D1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A5A077C1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 8A5A075B1AC1A0DF00C6F7DF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8A5A07391AC1A0DF00C6F7DF /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8A5A07401AC1A0DF00C6F7DF; + remoteInfo = RZSingleChildTransitionBug; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 8A5A07411AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RZSingleChildTransitionBug.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8A5A07451AC1A0DF00C6F7DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8A5A07461AC1A0DF00C6F7DF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 8A5A07481AC1A0DF00C6F7DF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 8A5A07491AC1A0DF00C6F7DF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 8A5A074B1AC1A0DF00C6F7DF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 8A5A074C1AC1A0DF00C6F7DF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 8A5A07511AC1A0DF00C6F7DF /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 8A5A07541AC1A0DF00C6F7DF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 8A5A075A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RZSingleChildTransitionBugTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 8A5A075F1AC1A0DF00C6F7DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8A5A07601AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RZSingleChildTransitionBugTests.m; sourceTree = ""; }; + 8A5A077B1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RZSingleChildContainerViewController.h; path = ../../RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h; sourceTree = ""; }; + 8A5A077C1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RZSingleChildContainerViewController.m; path = ../../RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8A5A073E1AC1A0DF00C6F7DF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8A5A07571AC1A0DF00C6F7DF /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8A5A07381AC1A0DF00C6F7DF = { + isa = PBXGroup; + children = ( + 8A5A077A1AC1B0A100C6F7DF /* External */, + 8A5A07431AC1A0DF00C6F7DF /* RZSingleChildTransitionBug */, + 8A5A075D1AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests */, + 8A5A07421AC1A0DF00C6F7DF /* Products */, + ); + sourceTree = ""; + }; + 8A5A07421AC1A0DF00C6F7DF /* Products */ = { + isa = PBXGroup; + children = ( + 8A5A07411AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.app */, + 8A5A075A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 8A5A07431AC1A0DF00C6F7DF /* RZSingleChildTransitionBug */ = { + isa = PBXGroup; + children = ( + 8A5A07481AC1A0DF00C6F7DF /* AppDelegate.h */, + 8A5A07491AC1A0DF00C6F7DF /* AppDelegate.m */, + 8A5A074B1AC1A0DF00C6F7DF /* ViewController.h */, + 8A5A074C1AC1A0DF00C6F7DF /* ViewController.m */, + 8A5A07511AC1A0DF00C6F7DF /* Images.xcassets */, + 8A5A07531AC1A0DF00C6F7DF /* LaunchScreen.xib */, + 8A5A07441AC1A0DF00C6F7DF /* Supporting Files */, + ); + path = RZSingleChildTransitionBug; + sourceTree = ""; + }; + 8A5A07441AC1A0DF00C6F7DF /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8A5A07451AC1A0DF00C6F7DF /* Info.plist */, + 8A5A07461AC1A0DF00C6F7DF /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 8A5A075D1AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests */ = { + isa = PBXGroup; + children = ( + 8A5A07601AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.m */, + 8A5A075E1AC1A0DF00C6F7DF /* Supporting Files */, + ); + path = RZSingleChildTransitionBugTests; + sourceTree = ""; + }; + 8A5A075E1AC1A0DF00C6F7DF /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8A5A075F1AC1A0DF00C6F7DF /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 8A5A077A1AC1B0A100C6F7DF /* External */ = { + isa = PBXGroup; + children = ( + 8A5A077B1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.h */, + 8A5A077C1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.m */, + ); + name = External; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8A5A07401AC1A0DF00C6F7DF /* RZSingleChildTransitionBug */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8A5A07641AC1A0DF00C6F7DF /* Build configuration list for PBXNativeTarget "RZSingleChildTransitionBug" */; + buildPhases = ( + 8A5A073D1AC1A0DF00C6F7DF /* Sources */, + 8A5A073E1AC1A0DF00C6F7DF /* Frameworks */, + 8A5A073F1AC1A0DF00C6F7DF /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RZSingleChildTransitionBug; + productName = RZSingleChildTransitionBug; + productReference = 8A5A07411AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.app */; + productType = "com.apple.product-type.application"; + }; + 8A5A07591AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8A5A07671AC1A0DF00C6F7DF /* Build configuration list for PBXNativeTarget "RZSingleChildTransitionBugTests" */; + buildPhases = ( + 8A5A07561AC1A0DF00C6F7DF /* Sources */, + 8A5A07571AC1A0DF00C6F7DF /* Frameworks */, + 8A5A07581AC1A0DF00C6F7DF /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 8A5A075C1AC1A0DF00C6F7DF /* PBXTargetDependency */, + ); + name = RZSingleChildTransitionBugTests; + productName = RZSingleChildTransitionBugTests; + productReference = 8A5A075A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8A5A07391AC1A0DF00C6F7DF /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0620; + ORGANIZATIONNAME = Raizlabs; + TargetAttributes = { + 8A5A07401AC1A0DF00C6F7DF = { + CreatedOnToolsVersion = 6.2; + }; + 8A5A07591AC1A0DF00C6F7DF = { + CreatedOnToolsVersion = 6.2; + TestTargetID = 8A5A07401AC1A0DF00C6F7DF; + }; + }; + }; + buildConfigurationList = 8A5A073C1AC1A0DF00C6F7DF /* Build configuration list for PBXProject "RZSingleChildTransitionBug" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 8A5A07381AC1A0DF00C6F7DF; + productRefGroup = 8A5A07421AC1A0DF00C6F7DF /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8A5A07401AC1A0DF00C6F7DF /* RZSingleChildTransitionBug */, + 8A5A07591AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8A5A073F1AC1A0DF00C6F7DF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8A5A07551AC1A0DF00C6F7DF /* LaunchScreen.xib in Resources */, + 8A5A07521AC1A0DF00C6F7DF /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8A5A07581AC1A0DF00C6F7DF /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8A5A073D1AC1A0DF00C6F7DF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8A5A074D1AC1A0DF00C6F7DF /* ViewController.m in Sources */, + 8A5A077D1AC1B0AC00C6F7DF /* RZSingleChildContainerViewController.m in Sources */, + 8A5A074A1AC1A0DF00C6F7DF /* AppDelegate.m in Sources */, + 8A5A07471AC1A0DF00C6F7DF /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8A5A07561AC1A0DF00C6F7DF /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8A5A07611AC1A0DF00C6F7DF /* RZSingleChildTransitionBugTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 8A5A075C1AC1A0DF00C6F7DF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8A5A07401AC1A0DF00C6F7DF /* RZSingleChildTransitionBug */; + targetProxy = 8A5A075B1AC1A0DF00C6F7DF /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 8A5A07531AC1A0DF00C6F7DF /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 8A5A07541AC1A0DF00C6F7DF /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 8A5A07621AC1A0DF00C6F7DF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 8A5A07631AC1A0DF00C6F7DF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 8A5A07651AC1A0DF00C6F7DF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = RZSingleChildTransitionBug/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8A5A07661AC1A0DF00C6F7DF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = RZSingleChildTransitionBug/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 8A5A07681AC1A0DF00C6F7DF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = RZSingleChildTransitionBugTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RZSingleChildTransitionBug.app/RZSingleChildTransitionBug"; + }; + name = Debug; + }; + 8A5A07691AC1A0DF00C6F7DF /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = RZSingleChildTransitionBugTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RZSingleChildTransitionBug.app/RZSingleChildTransitionBug"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8A5A073C1AC1A0DF00C6F7DF /* Build configuration list for PBXProject "RZSingleChildTransitionBug" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8A5A07621AC1A0DF00C6F7DF /* Debug */, + 8A5A07631AC1A0DF00C6F7DF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8A5A07641AC1A0DF00C6F7DF /* Build configuration list for PBXNativeTarget "RZSingleChildTransitionBug" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8A5A07651AC1A0DF00C6F7DF /* Debug */, + 8A5A07661AC1A0DF00C6F7DF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8A5A07671AC1A0DF00C6F7DF /* Build configuration list for PBXNativeTarget "RZSingleChildTransitionBugTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8A5A07681AC1A0DF00C6F7DF /* Debug */, + 8A5A07691AC1A0DF00C6F7DF /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8A5A07391AC1A0DF00C6F7DF /* Project object */; +} diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.h b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.h new file mode 100644 index 0000000..66e9987 --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// RZSingleChildTransitionBug +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.m b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.m new file mode 100644 index 0000000..a35e145 --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/AppDelegate.m @@ -0,0 +1,68 @@ +// +// AppDelegate.m +// RZSingleChildTransitionBug +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import "AppDelegate.h" +#import "RZSingleChildContainerViewController.h" + +@interface AppDelegate () + +@property (weak, nonatomic) RZSingleChildContainerViewController *singleChildViewController; + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + + RZSingleChildContainerViewController *singleChildVC = [[RZSingleChildContainerViewController alloc] init]; + self.window.rootViewController = singleChildVC; + self.singleChildViewController = singleChildVC; + [self.window makeKeyAndVisible]; + + UIViewController *viewController = [[UIViewController alloc] init]; + viewController.view.backgroundColor = [UIColor redColor]; + + UIViewController *viewController2 = [[UIViewController alloc] init]; + viewController2.view.backgroundColor = [UIColor blueColor]; + + UIViewController *viewController3 = [[UIViewController alloc] init]; + viewController3.view.backgroundColor = [UIColor greenColor]; + + [self.singleChildViewController setContentViewController:viewController animated:YES completion:nil]; + [self.singleChildViewController setContentViewController:viewController2 animated:YES completion:nil]; + [self.singleChildViewController setContentViewController:viewController3 animated:YES completion:nil]; + + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Base.lproj/LaunchScreen.xib b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..ccc95ca --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Images.xcassets/AppIcon.appiconset/Contents.json b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Info.plist b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Info.plist new file mode 100644 index 0000000..cb6e89d --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.raizlabs.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.h b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.h new file mode 100644 index 0000000..86c54ac --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// RZSingleChildTransitionBug +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.m b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.m new file mode 100644 index 0000000..6610336 --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// RZSingleChildTransitionBug +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/main.m b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/main.m new file mode 100644 index 0000000..d935d79 --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBug/main.m @@ -0,0 +1,16 @@ +// +// main.m +// RZSingleChildTransitionBug +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/Info.plist b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/Info.plist new file mode 100644 index 0000000..3069a9e --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.raizlabs.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/RZSingleChildTransitionBugTests.m b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/RZSingleChildTransitionBugTests.m new file mode 100644 index 0000000..40c47fe --- /dev/null +++ b/Tests/RZSingleChildTransitionBug/RZSingleChildTransitionBugTests/RZSingleChildTransitionBugTests.m @@ -0,0 +1,40 @@ +// +// RZSingleChildTransitionBugTests.m +// RZSingleChildTransitionBugTests +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import +#import + +@interface RZSingleChildTransitionBugTests : XCTestCase + +@end + +@implementation RZSingleChildTransitionBugTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/Tests/RZUtilsTests.xcodeproj/project.pbxproj b/Tests/RZUtilsTests.xcodeproj/project.pbxproj index 6ec8de0..d108f4b 100644 --- a/Tests/RZUtilsTests.xcodeproj/project.pbxproj +++ b/Tests/RZUtilsTests.xcodeproj/project.pbxproj @@ -16,8 +16,29 @@ D4874DA119918C46003EEC4B /* RZAutoLayoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D4874DA019918C46003EEC4B /* RZAutoLayoutTests.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 8A5A076F1AC1A0E000C6F7DF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8A5A076A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8A5A07411AC1A0DF00C6F7DF; + remoteInfo = RZSingleChildTransitionBug; + }; + 8A5A07711AC1A0E000C6F7DF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8A5A076A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8A5A075A1AC1A0DF00C6F7DF; + remoteInfo = RZSingleChildTransitionBugTests; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 22BAB0697B95400AAAD3740C /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 5803B47C971F7A07AA94BF3B /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 8A5A076A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RZSingleChildTransitionBug.xcodeproj; path = RZSingleChildTransitionBug/RZSingleChildTransitionBug.xcodeproj; sourceTree = ""; }; + 9102FF7D971233232FDB8D5B /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + 98E7E4BF710817E1D936B095 /* Pods.enterprise-qa.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods.enterprise-qa.xcconfig"; path = "Pods/Target Support Files/Pods/Pods.enterprise-qa.xcconfig"; sourceTree = ""; }; 9A8D4DD1196335CC00AFAB21 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 9A8D4DD3196335CC00AFAB21 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 9A8D4DD5196335CC00AFAB21 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; @@ -28,7 +49,6 @@ 9A8D4DFD196335CC00AFAB21 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 9A8D4EB4196336C500AFAB21 /* RZUtilsTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RZUtilsTests-Prefix.pch"; sourceTree = ""; }; 9A8D4EB51963431900AFAB21 /* RZBlockKVOTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RZBlockKVOTests.m; sourceTree = ""; }; - CFC331EF976D4DEC8CB9094C /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; D4874DA019918C46003EEC4B /* RZAutoLayoutTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RZAutoLayoutTests.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -47,13 +67,33 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 0719D20A0A6BCEB0E93477F5 /* Pods */ = { + isa = PBXGroup; + children = ( + 9102FF7D971233232FDB8D5B /* Pods.debug.xcconfig */, + 5803B47C971F7A07AA94BF3B /* Pods.release.xcconfig */, + 98E7E4BF710817E1D936B095 /* Pods.enterprise-qa.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 8A5A076B1AC1A0DF00C6F7DF /* Products */ = { + isa = PBXGroup; + children = ( + 8A5A07701AC1A0E000C6F7DF /* RZSingleChildTransitionBug.app */, + 8A5A07721AC1A0E000C6F7DF /* RZSingleChildTransitionBugTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; 9A8D4DC5196335CC00AFAB21 = { isa = PBXGroup; children = ( + 8A5A076A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.xcodeproj */, 9A8D4DF9196335CC00AFAB21 /* RZUtilsTests */, 9A8D4DD0196335CC00AFAB21 /* Frameworks */, 9A8D4DCF196335CC00AFAB21 /* Products */, - CFC331EF976D4DEC8CB9094C /* Pods.xcconfig */, + 0719D20A0A6BCEB0E93477F5 /* Pods */, ); sourceTree = ""; }; @@ -140,6 +180,12 @@ mainGroup = 9A8D4DC5196335CC00AFAB21; productRefGroup = 9A8D4DCF196335CC00AFAB21 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 8A5A076B1AC1A0DF00C6F7DF /* Products */; + ProjectRef = 8A5A076A1AC1A0DF00C6F7DF /* RZSingleChildTransitionBug.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 9A8D4DF1196335CC00AFAB21 /* RZUtilsTests */, @@ -147,6 +193,23 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 8A5A07701AC1A0E000C6F7DF /* RZSingleChildTransitionBug.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = RZSingleChildTransitionBug.app; + remoteRef = 8A5A076F1AC1A0E000C6F7DF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8A5A07721AC1A0E000C6F7DF /* RZSingleChildTransitionBugTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = RZSingleChildTransitionBugTests.xctest; + remoteRef = 8A5A07711AC1A0E000C6F7DF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 9A8D4DF0196335CC00AFAB21 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -171,7 +234,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; showEnvVarsInLog = 0; }; DFCEA1E42D714A99949F834D /* Check Pods Manifest.lock */ = { @@ -327,7 +390,7 @@ }; 9A8D4E09196335CC00AFAB21 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CFC331EF976D4DEC8CB9094C /* Pods.xcconfig */; + baseConfigurationReference = 9102FF7D971233232FDB8D5B /* Pods.debug.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -349,7 +412,7 @@ }; 9A8D4E0A196335CC00AFAB21 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CFC331EF976D4DEC8CB9094C /* Pods.xcconfig */; + baseConfigurationReference = 5803B47C971F7A07AA94BF3B /* Pods.release.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -367,7 +430,7 @@ }; 9A8D4E0B196335CC00AFAB21 /* Enterprise-QA */ = { isa = XCBuildConfiguration; - baseConfigurationReference = CFC331EF976D4DEC8CB9094C /* Pods.xcconfig */; + baseConfigurationReference = 98E7E4BF710817E1D936B095 /* Pods.enterprise-qa.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.h b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.h new file mode 100644 index 0000000..9a3eb1b --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// childViewControllerTransitionBugTest +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.m b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.m new file mode 100644 index 0000000..7a1f957 --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// childViewControllerTransitionBugTest +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/LaunchScreen.xib b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..e609e15 --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/Main.storyboard b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/Main.storyboard new file mode 100644 index 0000000..d912f9d --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Images.xcassets/AppIcon.appiconset/Contents.json b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Info.plist b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Info.plist new file mode 100644 index 0000000..4fb621f --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.raizlabs.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.h b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.h new file mode 100644 index 0000000..da952ed --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// childViewControllerTransitionBugTest +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.m b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.m new file mode 100644 index 0000000..baa30e8 --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// childViewControllerTransitionBugTest +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/main.m b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/main.m new file mode 100644 index 0000000..4c0c9cd --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTest/main.m @@ -0,0 +1,16 @@ +// +// main.m +// childViewControllerTransitionBugTest +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/Info.plist b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/Info.plist new file mode 100644 index 0000000..3069a9e --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.raizlabs.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/childViewControllerTransitionBugTestTests.m b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/childViewControllerTransitionBugTestTests.m new file mode 100644 index 0000000..75ef96f --- /dev/null +++ b/Tests/childViewControllerTransitionBugTest/childViewControllerTransitionBugTestTests/childViewControllerTransitionBugTestTests.m @@ -0,0 +1,40 @@ +// +// childViewControllerTransitionBugTestTests.m +// childViewControllerTransitionBugTestTests +// +// Created by John Stricker on 3/24/15. +// Copyright (c) 2015 Raizlabs. All rights reserved. +// + +#import +#import + +@interface childViewControllerTransitionBugTestTests : XCTestCase + +@end + +@implementation childViewControllerTransitionBugTestTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end From 9d9942409df2422184a72820adf638cccefba401 Mon Sep 17 00:00:00 2001 From: John Stricker Date: Tue, 24 Mar 2015 11:51:36 -0400 Subject: [PATCH 3/5] updated to use a single block & only take not of the last presentation request --- .../RZSingleChildContainerViewController.h | 8 --- .../RZSingleChildContainerViewController.m | 53 ++++++++----------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h index 2f0281f..813d501 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.h @@ -82,13 +82,5 @@ typedef void (^RZSingleChildContainerViewControllerCompletionBlock)(void); @end -@interface RZSingleChildContainerViewControllerQueuedPresentation : NSObject - -@property (copy, nonatomic) RZSingleChildContainerViewControllerCompletionBlock completionBlock; -@property (assign, nonatomic) BOOL animated; -@property (strong, nonatomic) UIViewController *viewController; - -@end - diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m index a44ff6a..778b520 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m @@ -56,7 +56,7 @@ @interface RZSingleChildContainerViewController () @property (weak, nonatomic) UIViewController *viewControllerOnWhichWeCalledBegin; -@property (strong, nonatomic) NSMutableArray *presentationQueue; +@property (copy, nonatomic) void(^queuedPresentationBlock)(); @end @@ -166,21 +166,17 @@ - (void)setContentViewController:(UIViewController *)viewController animated:(BO - (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(RZSingleChildContainerViewControllerCompletionBlock)completion { + __weak __typeof(self) weakSelf = self + ; if ( self.isTransitioning ) { - if ( self.presentationQueue == nil ) { - self.presentationQueue = [[NSMutableArray alloc] init]; - } - - RZSingleChildContainerViewControllerQueuedPresentation *queuedPresentation = [[RZSingleChildContainerViewControllerQueuedPresentation alloc] init]; - queuedPresentation.viewController = viewController; - queuedPresentation.animated = animated; - queuedPresentation.completionBlock = completion; - - [self.presentationQueue addObject:queuedPresentation]; + + self.queuedPresentationBlock = ^{ + [weakSelf setContentViewController:viewController animated:animated completion:completion]; + }; return; } - __weak __typeof(self) wself = self; + // We need to set isTransitioning to NO once the transition completes. // Then we run the passed-in completion block if it is not nil. @@ -189,33 +185,32 @@ - (void)setContentViewController:(UIViewController *)viewController animated:(BO if ( completion ) { completion(); } - if ( self.presentationQueue != nil && self.presentationQueue.count > 0 ) { - RZSingleChildContainerViewControllerQueuedPresentation *queuedPresentation = [self.presentationQueue firstObject]; - [self.presentationQueue removeObjectAtIndex:0]; - [self setContentViewController:queuedPresentation.viewController animated:queuedPresentation.animated completion:queuedPresentation.completionBlock]; + if ( self.queuedPresentationBlock != nil ) { + self.queuedPresentationBlock(); + self.queuedPresentationBlock = nil; } }; [self performBlockWhenViewLoaded:^{ self.isTransitioning = YES; - UIViewController *currentChild = wself.currentContentViewController; + UIViewController *currentChild = weakSelf.currentContentViewController; if ( animated ) { [currentChild beginAppearanceTransition:NO animated:YES]; [currentChild willMoveToParentViewController:nil]; - [wself addChildViewController:viewController]; - viewController.view.frame = [wself childContentContainerView].bounds; + [weakSelf addChildViewController:viewController]; + viewController.view.frame = [weakSelf childContentContainerView].bounds; viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [viewController beginAppearanceTransition:YES animated:YES]; - RZSingleChildContainerTransitionContext *ctx = [[RZSingleChildContainerTransitionContext alloc] initWithContainerVC:wself + RZSingleChildContainerTransitionContext *ctx = [[RZSingleChildContainerTransitionContext alloc] initWithContainerVC:weakSelf fromVC:currentChild toVC:viewController completion:compoundCompletion]; - [wself.contentVCAnimatedTransition animateTransition:ctx]; + [weakSelf.contentVCAnimatedTransition animateTransition:ctx]; } else { @@ -228,14 +223,14 @@ - (void)setContentViewController:(UIViewController *)viewController animated:(BO [currentChild removeFromParentViewController]; [currentChild endAppearanceTransition]; - [wself addChildViewController:viewController]; - viewController.view.frame = [wself childContentContainerView].bounds; + [weakSelf addChildViewController:viewController]; + viewController.view.frame = [weakSelf childContentContainerView].bounds; viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; if ( hasWindow ) { [viewController beginAppearanceTransition:YES animated:NO]; } - [[wself childContentContainerView] addSubview:viewController.view]; - [viewController didMoveToParentViewController:wself]; + [[weakSelf childContentContainerView] addSubview:viewController.view]; + [viewController didMoveToParentViewController:weakSelf]; if ( hasWindow ) { [viewController endAppearanceTransition]; } @@ -394,10 +389,4 @@ - (NSTimeInterval)transitionDuration:(id ) return kRZSingleChildContainerAlphaTransitionerAnimationDuration; } -@end - -@implementation RZSingleChildContainerViewControllerQueuedPresentation - -@end - - +@end \ No newline at end of file From 79e820b404223104e034ef8bd1a3bf37d7b7b746 Mon Sep 17 00:00:00 2001 From: John Stricker Date: Tue, 24 Mar 2015 11:57:47 -0400 Subject: [PATCH 4/5] changes as per PR --- .../RZSingleChildContainerViewController.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m index 778b520..258d98a 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m @@ -176,8 +176,7 @@ __weak __typeof(self) weakSelf = self return; } - - + // We need to set isTransitioning to NO once the transition completes. // Then we run the passed-in completion block if it is not nil. void (^compoundCompletion)(void) = ^{ From 94091ce658bad28b26f8b0c9efaea09937d2b710 Mon Sep 17 00:00:00 2001 From: John Stricker Date: Tue, 24 Mar 2015 13:07:16 -0400 Subject: [PATCH 5/5] new line added --- .../RZSingleChildContainerViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m index 258d98a..7de58bd 100644 --- a/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m +++ b/RZUtils/Components/RZSingleChildContainerViewController/RZSingleChildContainerViewController.m @@ -388,4 +388,4 @@ - (NSTimeInterval)transitionDuration:(id ) return kRZSingleChildContainerAlphaTransitionerAnimationDuration; } -@end \ No newline at end of file +@end