@@ -113,6 +113,7 @@ - (void)presentSafariVCWithBranchKey:(NSString *)branchKey {
113113 return ;
114114 }
115115
116+ // Must be on next run loop to avoid a warning
116117 dispatch_async (dispatch_get_main_queue (), ^{
117118 UIViewController * safController = [[SFSafariViewControllerClass alloc ] initWithURL: strongMatchUrl];
118119 self.secondWindow = [[UIWindow alloc ] initWithFrame: [[UIScreen mainScreen ] bounds ]];
@@ -121,6 +122,8 @@ - (void)presentSafariVCWithBranchKey:(NSString *)branchKey {
121122 [self .secondWindow setHidden: NO ];
122123 UIWindow *keyWindow = [[UIApplication sharedApplication ] keyWindow ];
123124 [self .secondWindow makeKeyWindow ];
125+
126+ // Give enough time for Safari to load the request (optimized for 3G)
124127 dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(2 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
125128 [keyWindow makeKeyWindow ];
126129
@@ -133,24 +136,6 @@ - (void)presentSafariVCWithBranchKey:(NSString *)branchKey {
133136 self.requestInProgress = NO ;
134137 });
135138 });
136-
137- // // Must be on next run loop to avoid a warning
138- // dispatch_async(dispatch_get_main_queue(), ^{
139- // // Add the safari view controller using view controller containment
140- // [windowRootController addChildViewController:safController];
141- // [windowRootController.view addSubview:safController.view];
142- // [safController didMoveToParentViewController:windowRootController];
143- //
144- // // Give a little bit of time for safari to load the request.
145- // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
146- // // Remove the safari view controller from view controller containment
147- // [safController willMoveToParentViewController:nil];
148- // [safController.view removeFromSuperview];
149- // [safController removeFromParentViewController];
150- //
151- //
152- // });
153- // });
154139 }
155140 else {
156141 self.requestInProgress = NO ;
0 commit comments