Gros probleme appli crash lecture video dans webview!
paddev
Membre
Bonjour,
En ouvrant une webview mon appli crash en recevant un "receivememorywarning", je ne comprend pas d'ou vient le probleme!
je crée ma webview dans une uiviewcontroller , je n'ai pas d'autre fichier.
Cela me confirme bien qu'il y a un souci pour lire les video sur le net.
Si quelqu'un peut verifier chez lui et surtout sur instrument car il y a des leaks dans urlconnections.
J'avais deja poster des messages sur ce probleme mais je pensais que cela venait d'objet non realeaser dans mon appli.
Mais la j'ouvre jsute une webview...
Je precise que j'utilise ARC.
merci pour votre aide !
Voici ce que m'affiche la debug area:
et voici mon code :
rootviewcontroller.m (ou j'appelle ma webview)
le fichier appdelegate.m
et le fichier appdelegate.h
En ouvrant une webview mon appli crash en recevant un "receivememorywarning", je ne comprend pas d'ou vient le probleme!
je crée ma webview dans une uiviewcontroller , je n'ai pas d'autre fichier.
Cela me confirme bien qu'il y a un souci pour lire les video sur le net.
Si quelqu'un peut verifier chez lui et surtout sur instrument car il y a des leaks dans urlconnections.
J'avais deja poster des messages sur ce probleme mais je pensais que cela venait d'objet non realeaser dans mon appli.
Mais la j'ouvre jsute une webview...
Je precise que j'utilise ARC.
merci pour votre aide !
Voici ce que m'affiche la debug area:
[Switching to process 8451 thread 0x2103]<br />[Switching to process 8707 thread 0x2203]<br />[Switching to process 7171 thread 0x1c03]<br />warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A334)/Symbols/System/Library/Internet Plug-Ins/QuickTime Plugin.webplugin/QuickTime Plugin (file not found).<br />warning: No copy of QuickTime Plugin.webplugin/QuickTime Plugin found locally, reading from memory on remote device. This may slow down the debug session.<br />2011-11-06 13:57:43.576 eleazar1[3905:707] Received memory warning.<br />(gdb)
et voici mon code :
rootviewcontroller.m (ou j'appelle ma webview)
<br />#import "RootViewController.h"<br /><br />@implementation RootViewController<br /><br />- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil<br />{<br /> self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];<br /> if (self) {<br /> // Custom initialization<br /> }<br /> return self;<br />}<br /><br />- (void)didReceiveMemoryWarning<br />{<br /> // Releases the view if it doesn't have a superview.<br /> [super didReceiveMemoryWarning];<br /> <br /> // Release any cached data, images, etc that aren't in use.<br />}<br /><br />#pragma mark - View lifecycle<br /><br />- (void)viewDidLoad<br />{<br /> CGRect webFrame=[[UIScreen mainScreen] bounds];<br /> UIWebView *myWebView=[[UIWebView alloc] initWithFrame:webFrame];<br /> [self.view addSubview:myWebView];<br /> [myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=1x8AnJAI6Go"]]];<br /> [super viewDidLoad];<br /> // Do any additional setup after loading the view from its nib.<br /> <br />}<br /><br />- (void)viewDidUnload<br />{<br /> [super viewDidUnload];<br /> // Release any retained subviews of the main view.<br /> // e.g. self.myOutlet = nil;<br />}<br /><br />- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation<br />{<br /> <br /> return (interfaceOrientation == UIInterfaceOrientationPortrait);<br />}<br /><br />@end<br />
le fichier appdelegate.m
<br />#import "AppDelegate.h"<br />#import "RootViewController.h"<br />@implementation AppDelegate<br /><br />@synthesize window = _window;<br />@synthesize managedObjectContext = __managedObjectContext;<br />@synthesize managedObjectModel = __managedObjectModel;<br />@synthesize persistentStoreCoordinator = __persistentStoreCoordinator;<br />@synthesize rootViewController = _rootViewController;<br /><br />- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions<br />{<br /> self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];<br /> self.rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];<br /> self.window.rootViewController = self.rootViewController;<br /> <br /> <br /> [self.window makeKeyAndVisible];<br /> return YES;<br />}<br /><br />- (void)applicationWillResignActive:(UIApplication *)application<br />{<br /> /*<br /> 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.<br /> 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.<br /> */<br />}<br /><br />- (void)applicationDidEnterBackground:(UIApplication *)application<br />{<br /> /*<br /> 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. <br /> If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.<br /> */<br />}<br /><br />- (void)applicationWillEnterForeground:(UIApplication *)application<br />{<br /> /*<br /> 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.<br /> */<br />}<br /><br />- (void)applicationDidBecomeActive:(UIApplication *)application<br />{<br /> /*<br /> 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.<br /> */<br />}<br /><br />- (void)applicationWillTerminate:(UIApplication *)application<br />{<br /> // Saves changes in the application's managed object context before the application terminates.<br /> [self saveContext];<br />}<br /><br />- (void)saveContext<br />{<br /> NSError *error = nil;<br /> NSManagedObjectContext *managedObjectContext = self.managedObjectContext;<br /> if (managedObjectContext != nil)<br /> {<br /> if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error])<br /> {<br /> /*<br /> Replace this implementation with code to handle the error appropriately.<br /> <br /> abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. <br /> */<br /> NSLog(@"Unresolved error %@, %@", error, [error userInfo]);<br /> abort();<br /> } <br /> }<br />}<br /><br />#pragma mark - Core Data stack<br /><br />/**<br /> Returns the managed object context for the application.<br /> If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.<br /> */<br />- (NSManagedObjectContext *)managedObjectContext<br />{<br /> if (__managedObjectContext != nil)<br /> {<br /> return __managedObjectContext;<br /> }<br /> <br /> NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];<br /> if (coordinator != nil)<br /> {<br /> __managedObjectContext = [[NSManagedObjectContext alloc] init];<br /> [__managedObjectContext setPersistentStoreCoordinator:coordinator];<br /> }<br /> return __managedObjectContext;<br />}<br /><br />/**<br /> Returns the managed object model for the application.<br /> If the model doesn't already exist, it is created from the application's model.<br /> */<br />- (NSManagedObjectModel *)managedObjectModel<br />{<br /> if (__managedObjectModel != nil)<br /> {<br /> return __managedObjectModel;<br /> }<br /> NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"eleazar1" withExtension:@"momd"];<br /> __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];<br /> return __managedObjectModel;<br />}<br /><br />/**<br /> Returns the persistent store coordinator for the application.<br /> If the coordinator doesn't already exist, it is created and the application's store added to it.<br /> */<br />- (NSPersistentStoreCoordinator *)persistentStoreCoordinator<br />{<br /> if (__persistentStoreCoordinator != nil)<br /> {<br /> return __persistentStoreCoordinator;<br /> }<br /> <br /> NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"eleazar1.sqlite"];<br /> <br /> NSError *error = nil;<br /> __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];<br /> if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])<br /> {<br /> /*<br /> Replace this implementation with code to handle the error appropriately.<br /> <br /> abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. <br /> <br /> Typical reasons for an error here include:<br /> * The persistent store is not accessible;<br /> * The schema for the persistent store is incompatible with current managed object model.<br /> Check the error message to determine what the actual problem was.<br /> <br /> <br /> If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.<br /> <br /> If you encounter schema incompatibility errors during development, you can reduce their frequency by:<br /> * Simply deleting the existing store:<br /> [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]<br /> <br /> * Performing automatic lightweight migration by passing the following dictionary as the options parameter: <br /> [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];<br /> <br /> Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.<br /> <br /> */<br /> NSLog(@"Unresolved error %@, %@", error, [error userInfo]);<br /> abort();<br /> } <br /> <br /> return __persistentStoreCoordinator;<br />}<br /><br />#pragma mark - Application's Documents directory<br /><br />/**<br /> Returns the URL to the application's Documents directory.<br /> */<br />- (NSURL *)applicationDocumentsDirectory<br />{<br /> return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];<br />}<br /><br />@end<br />
et le fichier appdelegate.h
#import <UIKit/UIKit.h><br />@class RootViewController;<br />@interface AppDelegate : UIResponder <UIApplicationDelegate><br />@property (strong,nonatomic) RootViewController *rootViewController;<br />@property (strong, nonatomic) UIWindow *window;<br /><br />@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;<br />@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;<br />@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;<br />- (void)saveContext;<br />- (NSURL *)applicationDocumentsDirectory;<br /><br />@end<br />
Connectez-vous ou Inscrivez-vous pour répondre.
Réponses