The app that I building is called "KiKi' and it's first page is "StartView". The app would run start view and check if user is logged in. After that, it would redirect user to the correct page.
The app runs fine on my iPhone 6 (the real one). But it always startup slowly when launching. It takes about 2-3 seconds to launch. (my other apps only takes about 1 second to launch).
Recently, I've submitted the app onto the iTunes Connect but it stuck at the "add new build version" page. I can't select any of the build version and it just displaying "(Processing)". I have waited for a few days but nothing changed. I believed that it's because of the bug in app.
Path: "StartView" --> "LoginView"(if user logged out) OR "LoginVerificationView"(if user logged in)
AppDelegate.h
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
AppDelegate.m (I've hided the APPLICATION KEYS for the parse service)
#import "AppDelegate.h"
#import <Parse/Parse.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// [Optional] Power your app with Local Datastore. For more info, go to
// https://parse.com/docs/ios_guide#localdatastore/iOS
[Parse enableLocalDatastore];
// Initialize Parse.
[Parse setApplicationId:@"PARSE_KEY1"
clientKey:@"PARSE_KEY2"];
PFInstallation *currentInstallation = [PFInstallation currentInstallation]; [currentInstallation saveInBackground];
// [Optional] Track statistics around application opens.
[PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [self colorWithHexString:@"000000"]}];
[[UINavigationBar appearance] setBarTintColor:[self colorWithHexString:@"c98b9a"]];
[[UINavigationBar appearance] setTintColor:[self colorWithHexString:@"00ff12"]];
// 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:.
}
-(UIColor*)colorWithHexString:(NSString*)hex
{
NSString *cString = [[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6) return [UIColor grayColor];
// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];
if ([cString length] != 6) return [UIColor grayColor];
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];
range.location = 2;
NSString *gString = [cString substringWithRange:range];
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float) r / 255.0f)
green:((float) g / 255.0f)
blue:((float) b / 255.0f)
alpha:1.0f];
}
@end
StartView.h
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import <ParseUI/ParseUI.h>
@interface StartView : UIViewController
@end
StartView.m
#import "StartView.h"
#import "LoginVerificationView.h"
#import "LoginView.h"
@interface StartView ()
@end
@implementation StartView
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
PFUser *currentUser = [PFUser currentUser];
if (currentUser) {
// redirect user to LoginVerificationView
LoginVerificationView *destview = [self.storyboard instantiateViewControllerWithIdentifier:@"SB-LoginVerificationView"];
[self presentViewController:destview animated:NO completion:nil];
} else {
// show the signup or login screen
LoginView *destview = [self.storyboard instantiateViewControllerWithIdentifier:@"SB-LoginView"];
[self presentViewController:destview animated:NO completion:nil];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Log (error log)
2015-10-26 00:25:46.416 Kiki[3121:97351] Simulator user has requested new graphics quality: 100
2015-10-26 00:25:46.457 Kiki[3121:97351] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
2015-10-26 00:25:46.741 Kiki[3121:97351] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
2015-10-26 00:25:48.544 Kiki[3121:97351] Presenting view controllers on detached view controllers is discouraged <StartView: 0x7f8d58f3f830>.
2015-10-26 00:25:48.683 Kiki[3121:97351] Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x7f8d5a842400>.