Skip to main content

Posts

MKMoviPlayer Notification

Some Notifications that generates MKMoviePlayer: MPMoviePlayerPlaybackStateDidChangeNotification MPMoviePlayerLoadStateDidChangeNotification [[ NSNotificationCenter defaultCenter ] addObserver : self                                              selector : @selector ( playBackStateChanged :)                                                  name : MPMoviePlayerLoadStateDidChangeNotification                                                 object : moviePlayerViewController . moviePlayer ]; -( void ) playBackStateChanged :( id ) sender {     MPMoviePlaybackState playbackState = [ moviePlayerViewControl...

UIWebView crash due to separate thread

Fixed the crash due to separate thread : -(void)viewDidLoad{     NSOperationQueue *operationQueue = [[ NSOperationQueue alloc ] init ]; NSInvocationOperation *operation = [[ NSInvocationOperation alloc ] initWithTarget : self selector : @selector (load) object : nil ]; [operationQueue addOperation :operation]; [operation release ]; [operationQueue release ]; } -( void )load {     [ NSThread sleepForTimeInterval : 1 ];     [ self performSelectorOnMainThread : @selector (loadWebView) withObject : nil waitUntilDone : NO ]; } -( void )loadWebView{     NSLog ( @"Runnnnn...." );           UIWebView *webView = [[ UIWebView alloc ] initWithFrame : self . view . bounds ];     [webView setUserInteractionEnabled : YES ];     NSString *docsDirectory =         [ NSSearchPathForDirectoriesInDomains ( NSDocumentDirectory , NSUserDomainMask...

XML Parser

If XML inside bundle : NSString  *pathStr = [[[ NSBundle   mainBundle ]  resourcePath ]  stringByAppendingPathComponent : @" Mobile_amountDue.xml " ];            NSData  *dataXml = [ NSData   dataWithContentsOfFile :pathStr];      url  = [[ NSURL   alloc ]  initWithString :pathStr];      xmlParser  = [[ NSXMLParser   alloc ]  initWithData :dataXml];      parser  = [[ XMLParser   alloc ]  initXMLParser : @"success" ];     [ xmlParser   setDelegate : parser ];     [ xmlParser   parse ]; if ([ newsArray   count ]> 0 ) { [ newsArray   removeAllObjects ];  }      newsArray =[ parser . parsedXML   mutableCopy ]; XML read from URL : #define  URL_STRING  @ "http://www.espncricinfo.com/rss/content/story/feeds/0.xml"...