Gros probleme appli crash lecture video dans webview!

paddevpaddev 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:

[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.&nbsp; 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 &quot;RootViewController.h&quot;<br /><br />@implementation RootViewController<br /><br />- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil<br />{<br />&nbsp; &nbsp; self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];<br />&nbsp; &nbsp; if (self) {<br />&nbsp; &nbsp; &nbsp; &nbsp; // Custom initialization<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; return self;<br />}<br /><br />- (void)didReceiveMemoryWarning<br />{<br />&nbsp; &nbsp; // Releases the view if it doesn&#039;t have a superview.<br />&nbsp; &nbsp; [super didReceiveMemoryWarning];<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; // Release any cached data, images, etc that aren&#039;t in use.<br />}<br /><br />#pragma mark - View lifecycle<br /><br />- (void)viewDidLoad<br />{<br />&nbsp; &nbsp; CGRect webFrame=[[UIScreen mainScreen] bounds];<br />&nbsp; &nbsp; UIWebView *myWebView=[[UIWebView alloc] initWithFrame:webFrame];<br />&nbsp; &nbsp; [self.view addSubview:myWebView];<br />&nbsp; &nbsp; [myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@&quot;http://www.youtube.com/watch?v=1x8AnJAI6Go&quot;]]];<br />&nbsp; &nbsp; [super viewDidLoad];<br />&nbsp; &nbsp; // Do any additional setup after loading the view from its nib.<br />&nbsp;  <br />}<br /><br />- (void)viewDidUnload<br />{<br />&nbsp; &nbsp; [super viewDidUnload];<br />&nbsp; &nbsp; // Release any retained subviews of the main view.<br />&nbsp; &nbsp; // e.g. self.myOutlet = nil;<br />}<br /><br />- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation<br />{<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; return (interfaceOrientation == UIInterfaceOrientationPortrait);<br />}<br /><br />@end<br />


le fichier appdelegate.m

<br />#import &quot;AppDelegate.h&quot;<br />#import &quot;RootViewController.h&quot;<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 />&nbsp; &nbsp; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];<br />&nbsp; &nbsp; self.rootViewController = [[RootViewController alloc] initWithNibName:@&quot;RootViewController&quot; bundle:nil];<br />&nbsp; &nbsp; self.window.rootViewController = self.rootViewController;<br />&nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; [self.window makeKeyAndVisible];<br />&nbsp; &nbsp; return YES;<br />}<br /><br />- (void)applicationWillResignActive:(UIApplication *)application<br />{<br />&nbsp; &nbsp; /*<br />&nbsp; &nbsp;  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 />&nbsp; &nbsp;  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 />&nbsp; &nbsp;  */<br />}<br /><br />- (void)applicationDidEnterBackground:(UIApplication *)application<br />{<br />&nbsp; &nbsp; /*<br />&nbsp; &nbsp;  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 />&nbsp; &nbsp;  If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.<br />&nbsp; &nbsp;  */<br />}<br /><br />- (void)applicationWillEnterForeground:(UIApplication *)application<br />{<br />&nbsp; &nbsp; /*<br />&nbsp; &nbsp;  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 />&nbsp; &nbsp;  */<br />}<br /><br />- (void)applicationDidBecomeActive:(UIApplication *)application<br />{<br />&nbsp; &nbsp; /*<br />&nbsp; &nbsp;  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 />&nbsp; &nbsp;  */<br />}<br /><br />- (void)applicationWillTerminate:(UIApplication *)application<br />{<br />&nbsp; &nbsp; // Saves changes in the application&#039;s managed object context before the application terminates.<br />&nbsp; &nbsp; [self saveContext];<br />}<br /><br />- (void)saveContext<br />{<br />&nbsp; &nbsp; NSError *error = nil;<br />&nbsp; &nbsp; NSManagedObjectContext *managedObjectContext = self.managedObjectContext;<br />&nbsp; &nbsp; if (managedObjectContext != nil)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if ([managedObjectContext hasChanges] &amp;&amp; ![managedObjectContext save:&amp;error])<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Replace this implementation with code to handle the error appropriately.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  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 />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  */<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NSLog(@&quot;Unresolved error %@, %@&quot;, error, [error userInfo]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; abort();<br />&nbsp; &nbsp; &nbsp; &nbsp; } <br />&nbsp; &nbsp; }<br />}<br /><br />#pragma mark - Core Data stack<br /><br />/**<br /> Returns the managed object context for the application.<br /> If the context doesn&#039;t already exist, it is created and bound to the persistent store coordinator for the application.<br /> */<br />- (NSManagedObjectContext *)managedObjectContext<br />{<br />&nbsp; &nbsp; if (__managedObjectContext != nil)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return __managedObjectContext;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];<br />&nbsp; &nbsp; if (coordinator != nil)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; __managedObjectContext = [[NSManagedObjectContext alloc] init];<br />&nbsp; &nbsp; &nbsp; &nbsp; [__managedObjectContext setPersistentStoreCoordinator:coordinator];<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; return __managedObjectContext;<br />}<br /><br />/**<br /> Returns the managed object model for the application.<br /> If the model doesn&#039;t already exist, it is created from the application&#039;s model.<br /> */<br />- (NSManagedObjectModel *)managedObjectModel<br />{<br />&nbsp; &nbsp; if (__managedObjectModel != nil)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return __managedObjectModel;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@&quot;eleazar1&quot; withExtension:@&quot;momd&quot;];<br />&nbsp; &nbsp; __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];<br />&nbsp; &nbsp; return __managedObjectModel;<br />}<br /><br />/**<br /> Returns the persistent store coordinator for the application.<br /> If the coordinator doesn&#039;t already exist, it is created and the application&#039;s store added to it.<br /> */<br />- (NSPersistentStoreCoordinator *)persistentStoreCoordinator<br />{<br />&nbsp; &nbsp; if (__persistentStoreCoordinator != nil)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return __persistentStoreCoordinator;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@&quot;eleazar1.sqlite&quot;];<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; NSError *error = nil;<br />&nbsp; &nbsp; __persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];<br />&nbsp; &nbsp; if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&amp;error])<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; /*<br />&nbsp; &nbsp; &nbsp; &nbsp;  Replace this implementation with code to handle the error appropriately.<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  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 />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  Typical reasons for an error here include:<br />&nbsp; &nbsp; &nbsp; &nbsp;  * The persistent store is not accessible;<br />&nbsp; &nbsp; &nbsp; &nbsp;  * The schema for the persistent store is incompatible with current managed object model.<br />&nbsp; &nbsp; &nbsp; &nbsp;  Check the error message to determine what the actual problem was.<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  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&#039;s resources directory instead of a writeable directory.<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  If you encounter schema incompatibility errors during development, you can reduce their frequency by:<br />&nbsp; &nbsp; &nbsp; &nbsp;  * Simply deleting the existing store:<br />&nbsp; &nbsp; &nbsp; &nbsp;  [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  * Performing automatic lightweight migration by passing the following dictionary as the options parameter: <br />&nbsp; &nbsp; &nbsp; &nbsp;  [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  Lightweight migration will only work for a limited set of schema changes; consult &quot;Core Data Model Versioning and Data Migration Programming Guide&quot; for details.<br />&nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp;  */<br />&nbsp; &nbsp; &nbsp; &nbsp; NSLog(@&quot;Unresolved error %@, %@&quot;, error, [error userInfo]);<br />&nbsp; &nbsp; &nbsp; &nbsp; abort();<br />&nbsp; &nbsp; }&nbsp; &nbsp; <br />&nbsp; &nbsp; <br />&nbsp; &nbsp; return __persistentStoreCoordinator;<br />}<br /><br />#pragma mark - Application&#039;s Documents directory<br /><br />/**<br /> Returns the URL to the application&#039;s Documents directory.<br /> */<br />- (NSURL *)applicationDocumentsDirectory<br />{<br />&nbsp; &nbsp; return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];<br />}<br /><br />@end<br />



et le fichier appdelegate.h

#import &lt;UIKit/UIKit.h&gt;<br />@class RootViewController;<br />@interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt;<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 />


Réponses

  • Alf1996Alf1996 Membre
    21:51 modifié #2
    Heu, c'est moi ou t'as ouvert 4 posts sur le même problème ?  :o  :o
  • muqaddarmuqaddar Administrateur
    21:51 modifié #3
    Je ne sais pas si c'est la même question, mais ça y ressemble... si c'est le cas, merci de ne pas multiplier les sujets.
Connectez-vous ou Inscrivez-vous pour répondre.