Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>-(void)viewDidLoad { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; if (!documentsDirectory) { NSLog(@"Documents directory not found!"); } NSArray *myWords = [songNameString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; NSString *appFile = [documentsDirectory stringByAppendingPathComponent:[myWords lastObject]]; NSLog(@"%@",[myWords lastObject]); NSURL *url = [NSURL fileURLWithPath:appFile]; NSLog(@"%@",url); [[UIApplication sharedApplication] setStatusBarHidden:YES]; self.navigationController.navigationBarHidden=YES; currentTimer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(showCurrentTime) userInfo:nil repeats:YES]; alarmTimeLabel.text =alarmTimeString; alarmSongLabel.text = [myWords lastObject] ; [self performSelector:@selector(loadVideoInBackground)]; //[NSThread detachNewThreadSelector:@selector(loadVideoInBackground) toTarget:self withObject:nil]; } -(void)loadVideoInBackground { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; if (!documentsDirectory) { NSLog(@"Documents directory not found!"); } NSString *appFile; NSArray *myWords = [songNameString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; appFile = [documentsDirectory stringByAppendingPathComponent:[myWords lastObject]]; NSFileManager *fileMgr=[NSFileManager defaultManager]; if (![fileMgr fileExistsAtPath:appFile]) { alarmCanPlay = FALSE; NSURL *imageURL = [[[NSURL alloc] initWithString:songNameString]autorelease]; NSURLRequest *imageRequest = [NSURLRequest requestWithURL:imageURL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:120.0]; imageConnection = [[NSURLConnection alloc] initWithRequest:imageRequest delegate:self]; if(imageConnection) { videoData = [[NSMutableData data] retain]; } } } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { // this method is called when the server has determined that it // has enough information to create the NSURLResponse // it can be called multiple times, for example in the case of a // redirect, so each time we reset the data. // receivedData is declared as a method instance elsewhere [videoData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { // append the new data to the receivedData // receivedData is declared as a method instance elsewhere //NSLog(@"%d",[data size]); [videoData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // release the data object [videoData release]; // inform the user NSLog(@"Connection failed! Error - %@ %@", [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]); //workInProgress = NO; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; if (!documentsDirectory) { NSLog(@"Documents directory not found!"); } NSString *appFile; NSArray *myWords = [songNameString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]]; appFile = [documentsDirectory stringByAppendingPathComponent:[myWords lastObject]]; [videoData writeToFile:appFile atomically:YES]; alarmCanPlay = TRUE; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload