Question

I am new to Objective C so this code is probably not written that well.

When the app is launched, it calls the following code if it has not been saved into the phone yet. When it starts to loop through the while loop, the app crashes on any phone the is not the iphone 5s. I think this is due to the memory usage. I believe that inside the while loop, when the NSMutableString (movieTitle) is created, is where the memory spike is. I should also add that the amount of times the loop is iterated is about 6000.

Basically html code is generated from a URL and this processes it to find movies and shows based on how the html on the website is written. It grabs all the movie names and show names so that I can use them for autocomplete.

if (appDelegate.movieArray.count == 0 && [self detectWifi]) {

    appDelegate.movieArray = [[NSMutableArray alloc]init];

    NSString *showUrlString = [NSString stringWithFormat:@"http://http:www.website1.com"];
    NSURL *ShowURL = [NSURL URLWithString:showUrlString];
    NSError *showerror;
    NSString *showPage = [NSString stringWithContentsOfURL:ShowURL
                                                  encoding:NSASCIIStringEncoding
                                                     error:&showerror];


    NSString *movieUrlString = [NSString stringWithFormat:@"http://www.website2.com"];
    NSURL *MovieURL = [NSURL URLWithString:movieUrlString];
    NSError *movieerror;
    NSString *moviePage = [NSString stringWithContentsOfURL:MovieURL
                                                   encoding:NSASCIIStringEncoding
                                                      error:&movieerror];

    showPage = [showPage substringFromIndex:[showPage rangeOfString:@"</a><span class=\"mw-editsection-bracket\">]</span></span></h2>"].location];
    showPage = [showPage substringToIndex:[showPage rangeOfString:@"NewPP limit report"].location];

    //Gets all movies
    moviePage = [moviePage substringFromIndex:[moviePage rangeOfString:@"</a><span class=\"mw-editsection-bracket\">]</span></span></h2>"].location];
    moviePage = [moviePage substringToIndex:[moviePage rangeOfString:@"<h2><span class=\"mw-headline\" id=\"Notes\">Notes</span>"].location];
    moviePage = [moviePage stringByAppendingString:showPage];
    int counter = 0;

    while ([moviePage rangeOfString:@"<li><i><a href=\""].location != NSNotFound) {

        @autoreleasepool{
            moviePage = [moviePage substringFromIndex:[moviePage rangeOfString:@"<li><i><a href=\""].location + 16];
            moviePage = [moviePage substringFromIndex:[moviePage rangeOfString:@">"].location + 1];
            NSMutableString *movieTitle = [self getTitle:moviePage];
            moviePage = [moviePage substringFromIndex:[moviePage rangeOfString:@"</li>"].location + 4];
            if (![appDelegate.movieArray containsObject:movieTitle]) [appDelegate.movieArray addObject:movieTitle];

        }

        counter ++;
        NSLog(@"%d",counter);
    }

    [[NSUserDefaults standardUserDefaults] setObject:appDelegate.movieArray forKey:@"movieArray"];
    NSLog(@"%@",appDelegate.movieArray);


}

This is the section where I think the phone crashes from a memory spike.

NSMutableString *movieTitle = [self getTitle:moviePage];

And here is the function for getTitle

-(NSMutableString*)getTitle:(NSString *)line {
@autoreleasepool{

NSMutableString *movieTitle = [[line substringToIndex:[line rangeOfString:@"</a>"].location]mutableCopy];

if ([movieTitle rangeOfString:@", The"].location != NSNotFound) {
    movieTitle = [[movieTitle substringToIndex:[movieTitle rangeOfString:@", The"].location]mutableCopy];
    movieTitle = [[@"The " stringByAppendingString:movieTitle]mutableCopy];
}
if ([movieTitle rangeOfString:@",The"].location != NSNotFound) {
    movieTitle = [[movieTitle substringToIndex:[movieTitle rangeOfString:@",The"].location]mutableCopy];
    movieTitle = [[@"The " stringByAppendingString:movieTitle]mutableCopy];
}

if ([movieTitle rangeOfString:@", A"].location != NSNotFound) {
    movieTitle = [[movieTitle substringToIndex:[movieTitle rangeOfString:@", A"].location]mutableCopy];
    movieTitle = [[@"A " stringByAppendingString:movieTitle]mutableCopy];
}
if ([movieTitle rangeOfString:@" ("].location != NSNotFound) {
    movieTitle = [[movieTitle substringToIndex:[movieTitle rangeOfString:@" ("].location]mutableCopy];
}
if ([movieTitle rangeOfString:@"&amp;"].location != NSNotFound) {
    movieTitle = [[movieTitle stringByReplacingOccurrencesOfString:@"&amp;" withString:@"&"]mutableCopy];
}
if ([movieTitle rangeOfString:@"&#039;"].location != NSNotFound) {
    movieTitle = [[movieTitle stringByReplacingOccurrencesOfString:@"&#039;" withString:@"'"]mutableCopy];
}
    return movieTitle;
}}

As you can see, I tried using a autoreleasepool to reduce the memory usage, but it wasnt enough to stop the app from crashing. I guess part of the problem for me is that I dont understand the memory rules of Apple. Also, I am using ARC rules, so I cannot simply call release, autorelease..etc.

Another weird problem is that on any iphone besides the 5s, when it is debugging in xcode (plugged into the mac and has the app running on it), the app runs and does not crash.

What can I do to make this code more efficiently so that I do not use much memory so that the app will work on all devices?

I simulated the error on an ipad 2:

    Incident Identifier: F63CD360-E641-400B-932D-31DAD0462785
CrashReporter Key:   3a33921df83f611ce711881c8d295ed62cc68b55
Hardware Model:      iPad2,1
Process:             MovieAlert [28858]
Path:                /var/mobile/Applications/26822004-FC06-4943-916C-5BBA670E22A2/MovieAlert.app/MovieAlert
Identifier:          com.netglow.MovieAlert.MovieAlert
Version:             1.0 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2014-03-03 12:22:02.873 -0500
OS Version:          iOS 7.1 (11D5145e)
Report Version:      104

Exception Type:  00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread:  0

Application Specific Information:
com.netglow.MovieAlert.MovieAlert failed to launch in time

Elapsed total CPU time (seconds): 24.630 (user 24.630, system 0.000), 56% CPU 
Elapsed application CPU time (seconds): 21.145, 48% CPU

Thread 0:
0   libsystem_platform.dylib        0x3b6f6490 _platform_memset$VARIANT$CortexA9 + 200
1   CoreFoundation                  0x3032c72e _CFRuntimeCreateInstance + 238
2   CoreFoundation                  0x303d26e8 __CFStringCreateImmutableFunnel3 + 1584
3   CoreFoundation                  0x3034d8a0 CFStringCreateWithSubstring + 324
4   CoreFoundation                  0x3034d734 -[__NSCFString substringWithRange:] + 192
5   MovieAlert                      0x000e4372 -[NGAppDelegate application:didFinishLaunchingWithOptions:] (NGAppDelegate.m:57)
6   UIKit                           0x32e0e392 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 270
7   UIKit                           0x32e0dce6 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1606
8   UIKit                           0x32e08376 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 710
9   UIKit                           0x32da4564 -[UIApplication handleEvent:withNewEvent:] + 3536
10  UIKit                           0x32da36cc -[UIApplication sendEvent:] + 68
11  UIKit                           0x32e07ab4 _UIApplicationHandleEvent + 612
12  GraphicsServices                0x353f8aea _PurpleEventCallback + 606
13  GraphicsServices                0x353f86d2 PurpleEventCallback + 30
14  CoreFoundation                  0x303c8ab4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
15  CoreFoundation                  0x303c8a4e __CFRunLoopDoSource1 + 342
16  CoreFoundation                  0x303c7222 __CFRunLoopRun + 1394
17  CoreFoundation                  0x30331f4a CFRunLoopRunSpecific + 518
18  CoreFoundation                  0x30331d2e CFRunLoopRunInMode + 102
19  UIKit                           0x32e06cdc -[UIApplication _run] + 756
20  UIKit                           0x32e01f90 UIApplicationMain + 1132
21  MovieAlert                      0x000e2e04 main (main.m:16)
22  libdyld.dylib                   0x3b5dbab4 start + 0

Thread 1:
0   libsystem_kernel.dylib          0x3b67e808 kevent64 + 24
1   libdispatch.dylib               0x3b5c0078 _dispatch_mgr_invoke + 228
2   libdispatch.dylib               0x3b5bfdfe _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2 name:  com.apple.NSURLConnectionLoader
Thread 2:
0   libsystem_kernel.dylib          0x3b67ea58 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3b67e854 mach_msg + 44
2   CoreFoundation                  0x303c8896 __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x303c6fbc __CFRunLoopRun + 780
4   CoreFoundation                  0x30331f4a CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x30331d2e CFRunLoopRunInMode + 102
6   Foundation                      0x30dcc082 +[NSURLConnection(Loader) _resourceLoadLoop:] + 314
7   Foundation                      0x30e41a5a __NSThread__main__ + 1058
8   libsystem_pthread.dylib         0x3b6fa916 _pthread_body + 138
9   libsystem_pthread.dylib         0x3b6fa886 _pthread_start + 98
10  libsystem_pthread.dylib         0x3b6f8aa0 thread_start + 4

Thread 3 name:  com.apple.CFSocket.private
Thread 3:
0   libsystem_kernel.dylib          0x3b691434 __select + 20
1   CoreFoundation                  0x303cc758 __CFSocketManager + 480
2   libsystem_pthread.dylib         0x3b6fa916 _pthread_body + 138
3   libsystem_pthread.dylib         0x3b6fa886 _pthread_start + 98
4   libsystem_pthread.dylib         0x3b6f8aa0 thread_start + 4

No thread state (register information) available
Binary Images:
0xd6000 - 0xf1fff MovieAlert armv7  <25966b3eebd83572af97492f994bdf9b> /var/mobile/Applications/26822004-FC06-4943-916C-5BBA670E22A2/MovieAlert.app/MovieAlert
0x2be97000 - 0x2beb7fff dyld armv7  <651a31c39f71311f965f8ac44de02c88> /usr/lib/dyld
0x2f3c2000 - 0x2f3c2fff Accelerate armv7  <0424978b39f037a7b3bf9aad5b34a5b3> /System/Library/Frameworks/Accelerate.framework/Accelerate
0x2f3cc000 - 0x2f598fff vImage armv7  <c4834965bdc638fcb1082f53a7721f42> /System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage
0x2f599000 - 0x2f672fff libBLAS.dylib armv7  <cfc693306499378c9c09851259cf3563> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib
0x2f673000 - 0x2f929fff libLAPACK.dylib armv7  <65970a4fea383446b0b4b87e634b8dfd> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib
0x2f92a000 - 0x2f998fff libvDSP.dylib armv7  <174c13fd605a39efbb7f1314a6d1fdbe> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib
0x2f999000 - 0x2f9aafff libvMisc.dylib armv7  <5a8317adbade34a9b415e44ab8c64eb6> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvMisc.dylib
0x2f9ab000 - 0x2f9abfff vecLib armv7  <7b2718a5a22c36e6ab943b2e4bea9123> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib
0x2f9ac000 - 0x2f9ccfff Accounts armv7  <0b9bb1f3e9393a64b396871da25800ad> /System/Library/Frameworks/Accounts.framework/Accounts
0x2f9ce000 - 0x2fa35fff AddressBook armv7  <0c20448202903b748c4327a73709338a> /System/Library/Frameworks/AddressBook.framework/AddressBook
0x2ffbb000 - 0x300c1fff CFNetwork armv7  <d94bd9129164355faff7d03f41ae1454> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x300c2000 - 0x3011dfff CoreAudio armv7  <3743aba20c61378cafc431586528feea> /System/Library/Frameworks/CoreAudio.framework/CoreAudio
0x30136000 - 0x30329fff CoreData armv7  <25051a1cf6f43bc5b239e97765e47150> /System/Library/Frameworks/CoreData.framework/CoreData
0x3032a000 - 0x3046cff0 CoreFoundation armv7  <1dd76db545823e66b2edec77483773da> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x3046d000 - 0x30590fff CoreGraphics armv7  <1028e9968124351189c7f77948e163e8> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x30592000 - 0x305cdfff libCGFreetype.A.dylib armv7  <92d7ea576fa632f5b5a0ac3a69145da2> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCGFreetype.A.dylib
0x305cf000 - 0x305d9fff libCMSBuiltin.A.dylib armv7  <825bfe1b1de6349c8ac49a589630169a> /System/Library/Frameworks/CoreGraphics.framework/Resources/libCMSBuiltin.A.dylib
0x307be000 - 0x307d8fff libRIP.A.dylib armv7  <5dc92ebb2f983b1eafb23c0604d9f4f9> /System/Library/Frameworks/CoreGraphics.framework/Resources/libRIP.A.dylib
0x307d9000 - 0x308b2fff CoreImage armv7  <445d568e94203ce097fa2c0656dce34c> /System/Library/Frameworks/CoreImage.framework/CoreImage
0x3093a000 - 0x30a10fff CoreMedia armv7  <cf2a71490b6d3708842fb714960bbfd9> /System/Library/Frameworks/CoreMedia.framework/CoreMedia
0x30aba000 - 0x30b12fff CoreTelephony armv7  <1eb6c2ffc4fb3d68b9822eef7822f52f> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
0x30b13000 - 0x30ba3fff CoreText armv7  <5a61d9eac4e333f98b340f16224bbc64> /System/Library/Frameworks/CoreText.framework/CoreText
0x30ba4000 - 0x30bb3fff CoreVideo armv7  <73eeed7f748b3f849e8ad2a7e2a7800b> /System/Library/Frameworks/CoreVideo.framework/CoreVideo
0x30d73000 - 0x30f5efff Foundation armv7  <477845f3d5773aabbe7174a058748af5> /System/Library/Frameworks/Foundation.framework/Foundation
0x31140000 - 0x31196fff IOKit armv7  <0c16d24d08c03311a4287ba1fedc97d9> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x31197000 - 0x313a7fff ImageIO armv7  <36622ea25a103073a3cdc01d6864e1fa> /System/Library/Frameworks/ImageIO.framework/ImageIO
0x313a8000 - 0x315effff JavaScriptCore armv7  <0aeca66c6e9e36d29664d8bf9c91becf> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
0x316a0000 - 0x316a4fff MediaAccessibility armv7  <e16d0e0e0ed43b9abaea986acfd1541b> /System/Library/Frameworks/MediaAccessibility.framework/MediaAccessibility
0x31d81000 - 0x31de4fff MobileCoreServices armv7  <abf040aa62e83c1ca73e3f67f6c77135> /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
0x3281f000 - 0x32827fff OpenGLES armv7  <f85d0c19c706371ca5cf2b9e5a866ac3> /System/Library/Frameworks/OpenGLES.framework/OpenGLES
0x32829000 - 0x32829fff libCVMSPluginSupport.dylib armv7  <5ce23815dfff33f897263195d4268bb1> /System/Library/Frameworks/OpenGLES.framework/libCVMSPluginSupport.dylib
0x3282d000 - 0x32830fff libCoreVMClient.dylib armv7  <14c03d0f122d347cabe9f2041546d7cd> /System/Library/Frameworks/OpenGLES.framework/libCoreVMClient.dylib
0x32831000 - 0x32838fff libGFXShared.dylib armv7  <e83c18bcbf5e3490b5acefc7f3e7a9be> /System/Library/Frameworks/OpenGLES.framework/libGFXShared.dylib
0x32839000 - 0x32877fff libGLImage.dylib armv7  <1e247052e47436548415ab280cc11c79> /System/Library/Frameworks/OpenGLES.framework/libGLImage.dylib
0x32a10000 - 0x32b56fff QuartzCore armv7  <0be445ab8f12384dad17e334eb3f345e> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x32bb0000 - 0x32bf2fff Security armv7  <4d6330d2e61b3ab09d375360c32576c0> /System/Library/Frameworks/Security.framework/Security
0x32d42000 - 0x32d91fff SystemConfiguration armv7  <d738fbcae22f390cac3723eb5d13dac3> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
0x32d94000 - 0x33506fff UIKit armv7  <87d0e5783118303c866265c3e3b336bd> /System/Library/Frameworks/UIKit.framework/UIKit
0x33507000 - 0x33565fff VideoToolbox armv7  <e6616b1ba9f03ee6ae38840430cfe46f> /System/Library/Frameworks/VideoToolbox.framework/VideoToolbox
0x338da000 - 0x338defff AggregateDictionary armv7  <f7a8934405673811b2d5cc1589992308> /System/Library/PrivateFrameworks/AggregateDictionary.framework/AggregateDictionary
0x33f35000 - 0x33f73fff AppSupport armv7  <b02117a514fe35d0a10f8d672275bdf7> /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport
0x340a1000 - 0x340aefff AssetsLibraryServices armv7  <96b089ed2f673f4a80c40f92425e744c> /System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices
0x340d0000 - 0x340f5fff BackBoardServices armv7  <f628c15a40e5357e89517f4e28eb3ec9> /System/Library/PrivateFrameworks/BackBoardServices.framework/BackBoardServices
0x340ff000 - 0x34123fff Bom armv7  <8f0339cf133c37f9aeae46b2eea15888> /System/Library/PrivateFrameworks/Bom.framework/Bom
0x342e9000 - 0x342eefff CertUI armv7  <ad425d142e6735bd9d3da49a1311676f> /System/Library/PrivateFrameworks/CertUI.framework/CertUI
0x3442d000 - 0x34438fff CommonUtilities armv7  <af20e5f8966e3602867c2d8e6a1e5e58> /System/Library/PrivateFrameworks/CommonUtilities.framework/CommonUtilities
0x34439000 - 0x3443dfff CommunicationsFilter armv7  <e68a117e6ff93365881b918333e9dac6> /System/Library/PrivateFrameworks/CommunicationsFilter.framework/CommunicationsFilter
0x344cf000 - 0x344d1fff ConstantClasses armv7  <1e58c2c1754434dfa17eac3077bd7d5f> /System/Library/PrivateFrameworks/ConstantClasses.framework/ConstantClasses
0x347a7000 - 0x347c5fff CoreServicesInternal armv7  <7012d60bb7a53110a47c4ff79da280a6> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/CoreServicesInternal
0x347c6000 - 0x347c7fff CoreSurface armv7  <1270576b60a83105bf2f90777891d6ff> /System/Library/PrivateFrameworks/CoreSurface.framework/CoreSurface
0x3486e000 - 0x348cafff CoreUI armv7  <b2a9ebb5554330b48818cbaebbd06e47> /System/Library/PrivateFrameworks/CoreUI.framework/CoreUI
0x3491f000 - 0x34924fff CrashReporterSupport armv7  <3826acd6c46733dfaa25fad464d2d05b> /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport
0x34af1000 - 0x34b07fff DataAccessExpress armv7  <e2dd0e9263033d5087fb6fd442a75afe> /System/Library/PrivateFrameworks/DataAccessExpress.framework/DataAccessExpress
0x34b4c000 - 0x34b66fff DictionaryServices armv7  <82612d87ae5a389186b0c6646b976cbf> /System/Library/PrivateFrameworks/DictionaryServices.framework/DictionaryServices
0x34bab000 - 0x34bb6fff ExFAT armv7  <a7ed638f895c3c668ce265301d9298dc> /System/Library/PrivateFrameworks/ExFAT.framework/ExFAT
0x34bf6000 - 0x35011fff FaceCore armv7  <05a9f9e1498a3e1fb7e81fbe9d11957d> /System/Library/PrivateFrameworks/FaceCore.framework/FaceCore
0x353ee000 - 0x35404fff GraphicsServices armv7  <3336797b4ea832a49465bcf8d28d4035> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x357b4000 - 0x3580efff IMFoundation armv7  <71449f02bd6938829e7ddd27bf3146a8> /System/Library/PrivateFrameworks/IMFoundation.framework/IMFoundation
0x35818000 - 0x3581ffff IOMobileFramebuffer armv7  <8baee98c3eb037f889058898d2bef098> /System/Library/PrivateFrameworks/IOMobileFramebuffer.framework/IOMobileFramebuffer
0x35820000 - 0x35825fff IOSurface armv7  <f8ae7830325238da878f24e51b441ea8> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface
0x35c0a000 - 0x35c16fff MobileAsset armv7  <a6f6e8e8a2983fbbac4f598f5f48389a> /System/Library/PrivateFrameworks/MobileAsset.framework/MobileAsset
0x35c61000 - 0x35c6bfff MobileKeyBag armv7  <d771b14eca873697a89656733e525c59> /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag
0x35c93000 - 0x35c96fff MobileSystemServices armv7  <3b84379e817537fc80eb2997057c0007> /System/Library/PrivateFrameworks/MobileSystemServices.framework/MobileSystemServices
0x35f8b000 - 0x35f8dfff OAuth armv7  <75dabd95dfda36be94c5e1098f9f960c> /System/Library/PrivateFrameworks/OAuth.framework/OAuth
0x366e5000 - 0x36720fff OpenCL armv7  <494eb61ad8c7374bbd5776579467a1ae> /System/Library/PrivateFrameworks/OpenCL.framework/OpenCL
0x37107000 - 0x3713afff PhysicsKit armv7  <7275cf1a482e30b39e84d6852b8e7be3> /System/Library/PrivateFrameworks/PhysicsKit.framework/PhysicsKit
0x37231000 - 0x37268fff PrintKit armv7  <c4178b526bf23481862b4c31c0cead81> /System/Library/PrivateFrameworks/PrintKit.framework/PrintKit
0x3726c000 - 0x372f2fff ProofReader armv7  <db664016aae8358194ed4ca13bfa4652> /System/Library/PrivateFrameworks/ProofReader.framework/ProofReader
0x3763b000 - 0x37650fff SpringBoardServices armv7  <7b177f9da6263e1997c24eff8de42d60> /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
0x37a39000 - 0x37a3bfff TCC armv7  <9ce710d3eb5a3e768105a9b68a8c9c9d> /System/Library/PrivateFrameworks/TCC.framework/TCC
0x37a8f000 - 0x37ab0fff TelephonyUtilities armv7  <494d021e9df33e7f8656ff22c95bb029> /System/Library/PrivateFrameworks/TelephonyUtilities.framework/TelephonyUtilities
0x380d9000 - 0x3810cfff TextInput armv7  <beda138388f63ab1b6916d36e974ca9b> /System/Library/PrivateFrameworks/TextInput.framework/TextInput
0x38390000 - 0x38450fff UIFoundation armv7  <85d44c28479732489d10f371084217e7> /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation
0x38468000 - 0x3846bfff UserFS armv7  <87db207bdb383551be56386a8849ffc6> /System/Library/PrivateFrameworks/UserFS.framework/UserFS
0x3890b000 - 0x393b2fff WebCore armv7  <8f60d6bf0b1336ae967c48db7236f39a> /System/Library/PrivateFrameworks/WebCore.framework/WebCore
0x393b3000 - 0x39473fff WebKit armv7  <b4e3ae6007c833a195815f034949d656> /System/Library/PrivateFrameworks/WebKit.framework/WebKit
0x395be000 - 0x395c6fff XPCObjects armv7  <6f8ac65cd26132dda80f1ae065ad5884> /System/Library/PrivateFrameworks/XPCObjects.framework/XPCObjects
0x3a590000 - 0x3a597fff libAccessibility.dylib armv7  <eb98252afe373c488c7669d56c982b10> /usr/lib/libAccessibility.dylib
0x3a6a2000 - 0x3a6b8fff libCRFSuite.dylib armv7  <b3daa0f4be4c33af860990ee476791bc> /usr/lib/libCRFSuite.dylib
0x3a6ce000 - 0x3a6e3fff libMobileGestalt.dylib armv7  <47289759f4c83507b2a9afed6bd7251c> /usr/lib/libMobileGestalt.dylib
0x3a701000 - 0x3a702fff libSystem.B.dylib armv7  <97960d9242ec3758840f47db50f187cf> /usr/lib/libSystem.B.dylib
0x3a771000 - 0x3a7a2fff libTelephonyUtilDynamic.dylib armv7  <e2d62970e01b373f9b8ad4c4aee0a674> /usr/lib/libTelephonyUtilDynamic.dylib
0x3a8f1000 - 0x3a8fdfff libbsm.0.dylib armv7  <cbf50b2cb2ae3ff385d5d853551a33cf> /usr/lib/libbsm.0.dylib
0x3a8fe000 - 0x3a907fff libbz2.1.0.dylib armv7  <3a4d64c44c283997b46efa5712f9c2d1> /usr/lib/libbz2.1.0.dylib
0x3a908000 - 0x3a953fff libc++.1.dylib armv7  <a9e17626396330e4be0a636d853ecded> /usr/lib/libc++.1.dylib
0x3a954000 - 0x3a96efff libc++abi.dylib armv7  <dd16288fdf2d35179c1db87dcec17f2c> /usr/lib/libc++abi.dylib
0x3a97e000 - 0x3a985fff libcupolicy.dylib armv7  <c3a9cab470003636b63fe439f9b577a3> /usr/lib/libcupolicy.dylib
0x3aade000 - 0x3abcbfff libiconv.2.dylib armv7  <3faa29f3ddf53187b51e155344592e1b> /usr/lib/libiconv.2.dylib
0x3abcc000 - 0x3ad1dfff libicucore.A.dylib armv7  <a0225e27ea6933558bc3dfecdcf626fc> /usr/lib/libicucore.A.dylib
0x3ad25000 - 0x3ad25fff liblangid.dylib armv7  <8bb499713b5632adb09d7bb3a7b77a71> /usr/lib/liblangid.dylib
0x3ad26000 - 0x3ad30fff liblockdown.dylib armv7  <b7f5354d32ee38efbd3d99b1464d837f> /usr/lib/liblockdown.dylib
0x3b0af000 - 0x3b24efff libobjc.A.dylib armv7  <43454f30280c34cb958f0304384d9770> /usr/lib/libobjc.A.dylib
0x3b332000 - 0x3b347fff libresolv.9.dylib armv7  <9d15aa14d7773e599e6cee134be9ebd0> /usr/lib/libresolv.9.dylib
0x3b370000 - 0x3b406fff libsqlite3.dylib armv7  <2bb2ac06753238828be8593055a08773> /usr/lib/libsqlite3.dylib
0x3b407000 - 0x3b454fff libstdc++.6.dylib armv7  <60d2a9f34296398bb7c057e01fde6afc> /usr/lib/libstdc++.6.dylib
0x3b455000 - 0x3b47bfff libtidy.A.dylib armv7  <1038b4aac4c9322fb6fc14b57e71ab02> /usr/lib/libtidy.A.dylib
0x3b47f000 - 0x3b532fff libxml2.2.dylib armv7  <610d9be70005338f9db94dbcaf1b6459> /usr/lib/libxml2.2.dylib
0x3b533000 - 0x3b554fff libxslt.1.dylib armv7  <c5d2c1db0a203d26a577d6c231b3640d> /usr/lib/libxslt.1.dylib
0x3b555000 - 0x3b561fff libz.1.dylib armv7  <76b41c58034a30dabe6ad9be1e637644> /usr/lib/libz.1.dylib
0x3b562000 - 0x3b566fff libcache.dylib armv7  <fefc4161821f300d85fff4af094b206c> /usr/lib/system/libcache.dylib
0x3b567000 - 0x3b56ffff libcommonCrypto.dylib armv7  <4c0bda8ed1b83b6d97f4fa911f22c83c> /usr/lib/system/libcommonCrypto.dylib
0x3b570000 - 0x3b574fff libcompiler_rt.dylib armv7  <8f8460474e9d36b4beb26f9851bd794d> /usr/lib/system/libcompiler_rt.dylib
0x3b575000 - 0x3b57bfff libcopyfile.dylib armv7  <7b5021a1b7d5386791a6d6b7658258f6> /usr/lib/system/libcopyfile.dylib
0x3b57c000 - 0x3b5b4fff libcorecrypto.dylib armv7  <912e56f196943500877e1aba46efcb78> /usr/lib/system/libcorecrypto.dylib
0x3b5b5000 - 0x3b5d9fff libdispatch.dylib armv7  <0b20ad8ff5373b85a62742a48cec386f> /usr/lib/system/libdispatch.dylib
0x3b5da000 - 0x3b5dbfff libdyld.dylib armv7  <5fc05181b5d03156a7a3ade0fc32276e> /usr/lib/system/libdyld.dylib
0x3b5dc000 - 0x3b5dcfff libkeymgr.dylib armv7  <754fc3f16bc53f01b4df0969a6461a1d> /usr/lib/system/libkeymgr.dylib
0x3b5dd000 - 0x3b5e3fff liblaunch.dylib armv7  <0c103f8e4aeb3416b54bdacf31fc2df1> /usr/lib/system/liblaunch.dylib
0x3b5e4000 - 0x3b5e7fff libmacho.dylib armv7  <9033cf6272eb3c789cdc2f426c401ffa> /usr/lib/system/libmacho.dylib
0x3b5e8000 - 0x3b5e9fff libremovefile.dylib armv7  <d7a3a855738935058cfd64a4429b2883> /usr/lib/system/libremovefile.dylib
0x3b5ea000 - 0x3b5f7fff libsystem_asl.dylib armv7  <c71706ec46b13bb89d6a9fd882ccc121> /usr/lib/system/libsystem_asl.dylib
0x3b5f8000 - 0x3b5f8fff libsystem_blocks.dylib armv7  <0178b6f1a9bf362d9672641076a42ee2> /usr/lib/system/libsystem_blocks.dylib
0x3b5f9000 - 0x3b65afff libsystem_c.dylib armv7  <b9729484ff92300bb601c95c2de24242> /usr/lib/system/libsystem_c.dylib
0x3b65b000 - 0x3b65dfff libsystem_configuration.dylib armv7  <5a3e13ad6e5b332d943b02ea0e2a6f37> /usr/lib/system/libsystem_configuration.dylib
0x3b65e000 - 0x3b664fff libsystem_dnssd.dylib armv7  <b4c9e43777c034589916c0e1df780035> /usr/lib/system/libsystem_dnssd.dylib
0x3b665000 - 0x3b67dfff libsystem_info.dylib armv7  <d9b6d914c95e39b1a788880c65e2c586> /usr/lib/system/libsystem_info.dylib
0x3b67e000 - 0x3b696fff libsystem_kernel.dylib armv7  <c53ca296071b3266b29ba64f0913c071> /usr/lib/system/libsystem_kernel.dylib
0x3b697000 - 0x3b6b6fff libsystem_m.dylib armv7  <c667c01b41913e38bc3a97417753a70d> /usr/lib/system/libsystem_m.dylib
0x3b6b7000 - 0x3b6c8fff libsystem_malloc.dylib armv7  <304862ec02e43c2d980a0852e2eaeda7> /usr/lib/system/libsystem_malloc.dylib
0x3b6c9000 - 0x3b6e9fff libsystem_network.dylib armv7  <0b4cc1aebe0a3bc7b036bb528107f338> /usr/lib/system/libsystem_network.dylib
0x3b6ea000 - 0x3b6f1fff libsystem_notify.dylib armv7  <f6561a42c76034358fa7f548d7370d3b> /usr/lib/system/libsystem_notify.dylib
0x3b6f2000 - 0x3b6f7fff libsystem_platform.dylib armv7  <9e431bb26aef3de5b81cd263f26376e8> /usr/lib/system/libsystem_platform.dylib
0x3b6f8000 - 0x3b6fdfff libsystem_pthread.dylib armv7  <eda21cf243e23680b1eb612f56cf610a> /usr/lib/system/libsystem_pthread.dylib
0x3b6fe000 - 0x3b6fffff libsystem_sandbox.dylib armv7  <cae56f034af23a1991bdfaba87c87880> /usr/lib/system/libsystem_sandbox.dylib
0x3b700000 - 0x3b702fff libsystem_stats.dylib armv7  <a254aceb982e370abd906f76ea94859c> /usr/lib/system/libsystem_stats.dylib
0x3b703000 - 0x3b703fff libunwind.dylib armv7  <45c29718368e3d1c8821911ab5953080> /usr/lib/system/libunwind.dylib
0x3b704000 - 0x3b71efff libxpc.dylib armv7  <8e38118685e5388db38bd8367d2d2c47> /usr/lib/system/libxpc.dylib
Was it helpful?

Solution

Generally, application should launch within 5 seconds from the time user tapped on the icon in his phone. If it doesn't launch within 5 seconds, then OS quits the app. Any tasks which take little longer has to be executed after the initialization of first view of the application.

Here is the link. https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

It says:

Your application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods should always be as lightweight as possible to reduce your app’s launch time. Apps are expected to launch and initialize themselves and start handling events in less than 5 seconds. If an app does not finish its launch cycle in a timely manner, the system kills it for being unresponsive. Thus, any tasks that might slow down your launch (such as accessing the network) should be executed asynchronously on a secondary thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top