Search Results

Search found 657 results on 27 pages for 'nsurl'.

Page 6/27 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How to cancel network request with afnetworking

    - by Jason Zhao
    Is there a way to cancel all network request (the request started by another method) before I do a network request with AFNetworking I tried like below: - (void)sendRequest:(NSUInteger)page{ NSURL *aUrl = [NSURL URLWithString:@"http://www.abc.com/"]; AFHTTPClient *httpClientToCancel = [[AFHTTPClient alloc] initWithBaseURL:aUrl]; [httpClientToCancel cancelAllHTTPOperationsWithMethod:@"POST" path:@"product/like"]; [httpClientToCancel release]; ... start a new request here ..... But not work. I just want to cancel all request (at least the request I wrote above) before I start a new request. Thank you!

    Read the article

  • Attempting to set a view's property results in an error: Request for Member … not a structure or …

    - by Mark McDonald
    I've declared a property in a view (created by interface builder, if it matters) and am trying to set the value from the view's controller – like so: self.view.url = someURL; That gives this error: Request for Member 'url' in something not a structure or union I have included the header for the view in the controller's .m file, but I'm probably just doing something wrong, but I don't know what – any ideas? The view code: @interface PDFView : UIView { NSURL *url; } @property (nonatomic, retain) NSURL *url; @end @implementation PDFView @synthesize url;

    Read the article

  • How to dismiss the table view created in the root view controller in iphone?

    - by Warrior
    I am new to iphone development. I have created a navigation based application. In the rootviewcontroller class i have written the code for parsing a url and display the contents in the table.In the didSelectRowAtIndexPath method i have written code for playing the video. NSURL *movieURL = [NSURL URLWithString:@"http://url of movie"]; if (movieURL) { if ([movieURL scheme]) { MovietryAppDelegate *appDelegate = (MovietryAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate initAndPlayMovie:movieURL]; } } In the delegate class i have defined the initAndPlayMovie method.I used the Apple sample "movie player " for my reference .I want to dismiss the table view before the video is loaded and table view appear back as presentmodalcontroller on clicking "done" button on video player.I want my app to work like you tube application. Please help me out.Thanks.

    Read the article

  • MPMoviePlayerController on large videos causes massive memory spike, and a level 1 memory warning

    - by Shizam
    When viewing images my application hums along nicely with low memory consumption, once I try to watch a video using MPMoviePlayerController memory usage spikes way up, dwarfing the previous memory graph and if I play the video it causes a 'memory warning. Level=1' message. The video files (mp4) aren't even that big, 40MB or so, and it doesn't matter if I play the file streamed from a URL or loaded from a local file, actually the memory spike is even worse if I try to stream it. Here is the code I use to create the player: if (_photo.videoPath != nil) { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:_photo.videoPath]]; } else { _movieViewController=[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:_photo.videoURL]]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoMetaListener:) name:MPMovieDurationAvailableNotification object:_movieViewController.moviePlayer]; _movieViewController.moviePlayer.scalingMode=MPMovieScalingModeAspectFit; _movieViewController.moviePlayer.shouldAutoplay = YES; _movieViewController.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; Anybody else running into issues playing video? Also I checked for leaks, there are none reported.

    Read the article

  • Can't change background for UIWebView in iPhone SDK

    - by leon
    Hi, Is there a way to change background color for UIWebView? None of the colors set in IB effect UIWebView behavior: before acctual content is loaded it shows as up as white (causing a white flash between the moment it is loaded and content is rendered). Setting background color programmatically does not do anything either. Here is code: @interface Web_ViewViewController : UIViewController { UIWebView *web; } @property (nonatomic, retain) IBOutlet UIWebView *web; @end .... (void)viewDidLoad { super viewDidLoad; web.backgroundColor = UIColor blueColor; NSURL *clUrl = NSURL URLWithString:@"http://www.apple.com" ; NSURLRequest *req = NSURLRequest requestWithURL:clUrl; web loadRequest:req; } thanks

    Read the article

  • Problems with video playback in iPad.

    - by Leg10n
    I'm trying to implement a MPMoviePlayerView but I can't play the video files, I don't have a device yet to try it on, now I'm testing with simulator, I don't know if this is the cause. So far I've been able to present the view and it shows the first frame of the video, but if I click play, it doesn't play I can move the progress bar and it shows the images, but there's no movement, it stays still. Has anyone experienced something like this? The code of my UIViewController goes like this: NSURL *movieURL=[NSURL fileURLWithPath:@"video.mp4"]; MPMoviePlayerViewController *playerView=[[MPMoviePlayerViewController alloc] initWithContentURL:movieURL]; [self presentMoviePlayerViewControllerAnimated:playerView]; As I said, it shows up, I can move the progress bar back and forth, I see a still image, but no movement. Am I missing something here? or is it the simulator? Thank you

    Read the article

  • UIWebView loading slow if using baseUrl

    - by ashish
    this works very well and fast but it does not load images if I give baseurl instead of nil. It takes few seconds to load. NSURL *myUrl = [[NSURL alloc] initFileURLWithPath:self.contentPath]; //NSLog(@”Content url is %@”,myUrl); NSString *string = [[NSString alloc]initWithContentsOfFile:self.contentPath encoding:NSASCIIStringEncoding error:nil]; [contentDisplay loadHTMLString:string baseURL:nil]; //here nil if replaced by myUrl webView takes time to load. Any help ? [string release]; [myUrl release];

    Read the article

  • MPMoviePlayerController problem when play a movie

    - by Momeks
    hi .. i put a movie when my application will lunch . just like gameloft games . so when application has lunched , movie plays fine but before the move plays .. my FirstViewController xib file show first then moview start to play ! why ? here is my code : - (void)applicationDidFinishLaunching:(UIApplication *)application { NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"m4v"]; NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; MPMoviePlayerController *IntroMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; IntroMovie.movieControlMode = MPMovieControlModeHidden; [IntroMovie play]; }

    Read the article

  • iPhone SDK : UIWebView detect link on textfeild !

    - by Momeks
    Hi i create simple web browser for my app and i don't know why when user click a link the address bar doesn't change as link address here is my code : -(IBAction)webAddress:(id)sender { [site loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webAdress text]]]]; [webAdress resignFirstResponder]; } - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { //CAPTURE USER LINK-CLICK. if (navigationType == UIWebViewNavigationTypeLinkClicked) { NSURL *URL = [request URL]; if ([[URL scheme] isEqualToString:@"http"]) { [webAdress setText:[URL absoluteString]]; [self webAddress:nil]; } return NO; } return YES; } what's my problem ?

    Read the article

  • Getting SHOUTcast metadata on the Mac

    - by Fernando Valente
    I'm creating an application in Objective-C and I need to get the metadata from a SHOUTcast stream. I tried this: NSURL *URL = [NSURL URLWithString:@"http://202.4.100.2:8000/"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; [request addValue:@"1" forHTTPHeaderField:@"icy-metadata"]; [request addValue:@"Winamp 5/3" forHTTPHeaderField:@"User-Agent"]; [request addValue:@"audio/mpeg" forHTTPHeaderField:@"Content-Type"]; [NSURLConnection connectionWithRequest:request delegate:self]; I would have to get the headers from this request in order to get the information, right? Unfortunately it keeps returning these headers: Date = "17 Apr 2010 21:57:14 -0200"; "Max-Age" = 0; What I'm doing wrong?

    Read the article

  • Stopping network activity indicator.

    - by iSharreth
    I used the below code to load a webpage. Everything works fine, but I want to stop the network activity indicator after completing loading the webpage. How can we know that the webpage is loaded completely. Anyone please help. UIApplication* app = [UIApplication sharedApplication]; app.networkActivityIndicatorVisible = YES; // to stop it, set this to NO NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request];

    Read the article

  • SOLVED mwfeedparser integrating in my app gives EXC_BAD_ACCESS (code=1, address=0xa0040008)

    - by Pranoy C
    SOLVED- Got it! The problem was that since I am creating the DoParsingStuff *parseThisUrl object in the viewDidLoad method, it's scope was only within that method. So after the method finished, the object got deallocated. I changed it to an instance variable instead and now it works. It gives a different error but that it an entirely different issue. Issue was: I have been struggling with trying to integrate the mwfeedparser library in my app for parsing RSS and ATOM feeds. It throws a gives EXC_BAD_ACCESS error which I can't seem to troubleshoot. //My Class looks like - My interface looks like: #import <Foundation/Foundation.h> #import "MWFeedParser.h" #import "NSString+HTML.h" @protocol ParseCompleted <NSObject> -(void)parsedArray:(NSMutableArray *)parsedArray; @end @interface DoParsingStuff : NSObject<MWFeedParserDelegate> @property (nonatomic,strong) NSMutableArray *parsedItems; @property (nonatomic, strong) NSArray *itemsToDisplay; @property (nonatomic,strong) MWFeedParser *feedParser; @property (nonatomic,strong) NSURL *feedurl; @property (nonatomic,strong) id <ParseCompleted> delegate; -(id)initWithFeedURL:(NSURL *)url; @end //And Implementaion: #import "DoParsingStuff.h" @implementation DoParsingStuff @synthesize parsedItems = _parsedItems; @synthesize itemsToDisplay = _itemsToDisplay; @synthesize feedParser = _feedParser; @synthesize feedurl=_feedurl; @synthesize delegate = _delegate; -(id)initWithFeedURL:(NSURL *)url{ if(self = [super init]){ _feedurl=url; _feedParser = [[MWFeedParser alloc] initWithFeedURL:_feedurl]; _feedParser.delegate=self; _feedParser.feedParseType=ParseTypeFull; _feedParser.connectionType=ConnectionTypeAsynchronously; } return self; } -(void)doParsing{ BOOL y = [_feedParser parse]; } # pragma mark - # pragma mark MWFeedParserDelegate - (void)feedParserDidStart:(MWFeedParser *)parser { //Just tells what url is being parsed e.g. http://www.wired.com/reviews/feeds/latestProductsRss NSLog(@"Started Parsing: %@", parser.url); } - (void)feedParser:(MWFeedParser *)parser didParseFeedInfo:(MWFeedInfo *)info { //What is the Feed about e.g. "Product Reviews" NSLog(@"Parsed Feed Info: “%@”", info.title); //self.title = info.title; } - (void)feedParser:(MWFeedParser *)parser didParseFeedItem:(MWFeedItem *)item { //Prints current element's title e.g. “An Arthropod for Your iDevices” NSLog(@"Parsed Feed Item: “%@”", item.title); if (item) [_parsedItems addObject:item]; } - (void)feedParserDidFinish:(MWFeedParser *)parser {//This is where you can do your own stuff with the parsed items NSLog(@"Finished Parsing%@", (parser.stopped ? @" (Stopped)" : @"")); [_delegate parsedArray:_parsedItems]; //[self updateTableWithParsedItems]; } - (void)feedParser:(MWFeedParser *)parser didFailWithError:(NSError *)error { NSLog(@"Finished Parsing With Error: %@", error); if (_parsedItems.count == 0) { //self.title = @"Failed"; // Show failed message in title } else { // Failed but some items parsed, so show and inform of error UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Parsing Incomplete" message:@"There was an error during the parsing of this feed. Not all of the feed items could parsed." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil]; [alert show]; } //[self updateTableWithParsedItems]; } @end //I am calling this from my main viewcontroller as such: #import "DoParsingStuff.h" @interface ViewController : UIViewController <ParseCompleted> .... //And I have the following methods in my implementation: DoParsingStuff *parseThisUrl = [[DoParsingStuff alloc] initWithFeedURL:[NSURL URLWithString:@"http://www.theverge.com/rss/index.xml"]]; parseThisUrl.delegate=self; [parseThisUrl doParsing]; I have the method defined here as- -(void)parsedArray:(NSMutableArray *)parsedArray{ NSLog(@"%@",parsedArray); } //I stepped through breakpoints- When I try to go through the breakpoints, I see that everything goes fine till the very last [parseThisUrl doParsing]; in my delegate class. After that it starts showing me memory registers where I get lost. I think it could be due to arc as I have disabled arc on the mwfeedparser files but am using arc in the above classes. If you need the entire project for this, let me know. I tried it with NSZombies enabled and got a bit more info out of it: -[DoParsingStuff respondsToSelector:]: message sent to deallocated instance 0x6a52480 I am not using release/autorelease/retain etc. in this class...but it is being used in the mwfeedparser library.

    Read the article

  • Operation could not be completed. AVAudioRecorder iphone SDK

    - by Jonathan
    I am trying to record using the iphones microphone: This is my code: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; // the path to write file NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"testing.mp3"]; NSURL *url = [NSURL fileURLWithPath:appFile isDirectory:NO]; NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithFloat: 44100.0], AVSampleRateKey, [NSNumber numberWithInt: kAudioFormatMPEGLayer3], AVFormatIDKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, [NSNumber numberWithInt: AVAudioQualityLow], AVEncoderAudioQualityKey, nil]; NSError *error; recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&error]; if ([recorder prepareToRecord] == YES){ [recorder record]; }else { int errorCode = CFSwapInt32HostToBig ([error code]); NSLog(@"Error: %@ [%4.4s])" , [error localizedDescription], (char*)&errorCode); } NSLog(@"BOOL = %d", (int)recorder.recording); This is the error I get: Operation could not be completed. (OSStatus error 1718449215.) And I can not work out why this doesn't work, as a lot of the code I got from a website. Jonathan

    Read the article

  • AVURLAsset cannot load with remote file

    - by Quentin
    Hi, I have a problem using AVURLAsset. NSString * const kContentURL = @ "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"; ... NSURL *contentURL = [NSURL URLWithString:kContentURL]; AVURLAsset *asset = [AVURLAsset URLAssetWithURL:contentURL options:nil]; [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracksKey] completionHandler:^{ ... NSError *error = nil; AVKeyValueStatus status = [asset statusOfValueForKey:tracksKey error:&error]; ... } In the completion block, the status is AVKeyValueStatusFailed and the error message is "Cannot Open". All exemples I have seen, use a local file, so maybe there is a problem using a remote file... Regards, Quentin

    Read the article

  • PHP and Objective C Communication

    - by meetS
    Hii, I have PHP script link,which responds YES or NO when we set post userName and emailID.I have used ASI framework. But it is not working....Here is my code....Thanks in advance... **NSURL *url = [NSURL URLWithString:@"https://abc.com/abctest/registration.php"]; ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url]; [request setPostValue:@"[email protected]" forKey:@"email"]; [request setPostValue:@"pqr" forKey:@"ebayName"]; [request start]; NSError *error = [request error]; if (!error) { NSString *response = [request responseString]; printf("\n\n\n Responce %s",[response UTF8String]); response = [response stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([response isEqualToString:@"YES"]) { printf("\n\n YES"); } }

    Read the article

  • Play video in UIWebView from NSData

    - by Papagalli
    Hello there, Does anybody know how to play a video in a UIVebView ? The video comes from the iphone library, when I pick it, I store it in core data as binary data. If i use the local url of the video it's working fine, the problem I have is that the this url refers to a folder named "tmp", and I don't know the lifetime of it. If I can get the real url of the video file it will be ok. //attachment is the core data object containing the data NSURL *url = [NSURL URLWithString:attachment.path]; [self.webView loadRequest:[NSURLRequest requestWithURL:url]]; I tried a solution that doesn't work: (i tried MIMETypes : "video/quicktime" and "video/mp4") [self.webView loadData:attachment.data MIMEType:@"video/mov" textEncodingName:nil baseURL:nil]; I think the second solution is the closest, and the problem comes from the MIMEType. Thanks by advance if anybody has a solution for this :)

    Read the article

  • Get json from Twitter API in iPhone using JSON Framework

    - by jozei
    Hello now I'm trying to get json data from Twitter API using iPhone. I'm using JSON Framework. This code has good results. #import "JSON/JSON.h" NSString *urlString= @"http://api.twitter.com/1/statuses/public_timeline.json"; NSURL *url = [NSURL URLWithString:urlString]; NSString *jsonString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; NSLog(@"%@", jsonString); But when I change API's URL like "http://search.twitter.com/trends/current.json" the above code gets SIGABRT error. Could someone explain it to me? Thanks.

    Read the article

  • Simplest way on iPhone to unzip downloaded file?

    - by Scott Pendleton
    Goal: download a zipped file, unzip it, and save it in the iPhone app's Documents directory. The following code makes use of the initWithGzippedData method that was added to NSData in the Molecule app found here: http://www.sunsetlakesoftware.com/molecules As adapted to my app: NSString *sFolder = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *sFileName = [sFolder stringByAppendingPathComponent:@"MyFile.db"]; NSURL *oURL = [NSURL URLWithString: @"http://www.isystant.com/Files/MyFile.zip"]; NSData *oZipData = [NSData dataWithContentsOfURL: oURL]; NSData *oData = [[NSData alloc] initWithGzippedData:oZipData]; [oZipData release]; b = [oData writeToFile:sFileName atomically:NO]; NSLog(@"Unzip %i", b); Result: A zip file is successfully downloaded. From it a new, supposedly unzipped file is created in the Documents directory with the desired name (MyFile.db) but it has zero bytes. Anybody see the problem? Or else is there a simpler way to unzip a downloaded file than the one used in the Molecules app?

    Read the article

  • UIWebView leak? Can someone confirm?

    - by Shaggy Frog
    I was leak-testing my current project and I'm stumped. I've been browsing like crazy and tried everything except chicken sacrifice. I just created a tiny toy project app from scratch and I can duplicate the leak in there. So either UIWebView has a leak or I'm doing something really silly. Essentially, it boils down to a loadRequest: call to a UIWebView object, given an URLRequest built from an NSURL which references a file URL, for a file in the app bundle, which lives inside a folder that Xcode is including by reference. Phew. The leak is intermittent but still happens ~75% of the time (in about 20 tests it happened about 15 times). It only happens on the device -- this does not leak in the simulator. I am testing targeting both iPhone OS 3.1.2 and 3.1.3, on an original (1st Gen) iPod Touch that is using iPhone OS 3.1.3. To reproduce, just create a project from scratch. Add a UIWebView to the RootViewController's .xib, hook it up via IBOutlet. In the Finder, create a folder named "html" inside your project's folder. Inside that folder, create a file named "dummy.html" that has the word "Test" in it. (Does not need to be valid HTML.) Then add the html folder to your project in Xcode by choosing "Create Folder References for any added folders" Add the following to viewDidLoad NSString* resourcePath = [[NSBundle mainBundle] resourcePath]; NSString* filePath = [[resourcePath stringByAppendingPathComponent:@"html"] stringByAppendingPathComponent:@"dummy.html"]; NSURL* url = [[NSURL alloc] initFileURLWithPath:filePath]; NSURLRequest* request = [NSURLRequest requestWithURL:url]; // <-- this creates the leak! [browserView loadRequest:request]; [url release]; I've tried everything from setting delegate for the UIWebView and implementing UIWebViewDelegate, to not setting a delegate in IB, to not setting a delegate in IB and explicitly setting the web view's delegate property to nil, to using alloc/init instead of getting autoreleased NSURLRequests (and/or NSURLs)... I tried the answer to a similar question (setting the shared URL cache to empty) and that did not help. Can anyone help?

    Read the article

  • cancel a ASIHTTPRequest thread

    - by user262325
    Hello evryone I have some codes to use ASINetworkQueue as multi thread download ASINetworkQueue *networkQueue; [networkQueue setDelegate:self]; [networkQueue setRequestDidFinishSelector:@selector(requestDone:)]; [networkQueue setShowAccurateProgress:true]; NSURL *url = [NSURL URLWithString:s]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDownloadProgressDelegate:a]; [request setTag:index]; [request setTimeOutSeconds:10]; [request setDelegate:self]; [networkQueue addOperation:request]; [networkQueue go]; if I try to use the code below to cancel the thread with index k [[[networkQueue operations] objectAtIndex:k] cancel]; I notice all requests in ASINetworkQueue were cancelled and stop working. Welcome any comment Thanks interdev

    Read the article

  • How do I keep music playing after the user presses the hold button on the iPhone?

    - by Carlos Vargas
    Hey guys how can I make an app keep playing an mp3 after pressed the hold/power button. Here is the code I use for preparing the AVAudioPlayer: - (void)PrepareAudio:(int)index { NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@",[_Audio objectAtIndex:Game]] ofType:@"mp3"]; NSURL *newURL = [[NSURL alloc] initFileURLWithPath: soundFilePath]; MusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: newURL error: nil]; [newURL release]; [MusicPlayer setVolume: 1.5]; } And this is the code when I press the button play: - (IBAction)PushPlay: (id)sender { if(!MusicPlayer.playing) [MusicPlayer play]; } Best Regards Carlos Vargas

    Read the article

  • Basic HTTP Authentication using Obj C and Xcode.

    - by Kristiaan
    Hi Everyone, I am hoping someone can help me with a question i have relating to Basic HTTP Authentication in an Xcode 2.3 application. Basically i have a PHP page that is on our server and when called with certain parameters returns data relating to the servers condition etc. i have managed to get a small Xcode application working where by it reads the data from the page and populates an NSTextView with the data. however to make sure this information stays safe i have setup basic HTTP Authentication on the page, but i cannot work out how to provide the username and password in XCode. here is my code to retrieve the page. NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSString *content = [NSString stringWIthContentsOfUrl:url]; [myTextView setString:content]; i am still at a very basic beginner level regarding xcode and obj c, so nice simple examples of how i go about this would really be appreciated. Thanks Kris

    Read the article

  • Load nsimage from url but only some url's work

    - by happyCoding25
    I have some code that loads an image file off the web and puts it in an image view. The problem is it works with everything but Google Charts. This is frustrating because I was relying on this to graph data for my app. Heres the url I need to load: Click to see my test chart. Im not sure why NSImage seems to refuse to load this when it works with everything elese. If you know why or have a work-around any help is appreciated. Heres some sample code I found that I'm using to load the images: NSURL *imageURL = [NSURL URLWithString:@"http://chart.apis.google.com/chart?cht=p3&chs=700x400&chd=t:20,20,20,20,20&chl=A|B|C|D|E&chco=66FF33,3333CC"]; NSLog(@"url"); NSData *imageData = [imageURL resourceDataUsingCache:NO]; NSLog(@"data"); NSImage *imageFromBundle = [[NSImage alloc] initWithData:imageData]; (Note: This code will load any image except a chart) Thanks

    Read the article

  • Iphone SDK: pathFoResource:Nsstring problem -> playin MP3 files

    - by Kaya
    I am trying to get 10 mp3 files in the resources folder and play them when a button is pressed. I have entered name of the mp3 files in a NSMutableArray and read each one after the button is pressed. The problem is that pathForResource: is not working (returns nil). If i use the file name explicitly -like pathFoResource:@"song1.mp3" ofType:@"mp3"- but if i use pathForResource:valuem whwre valuem is an NSstring with value of song1 Hope you can help Regards NSString *cellValue0 = [listOfmp3 objectAtIndex:anumber]; NSString *valuem; if ( [cellValue0 length] 0 ) valuem = [cellValue0 substringToIndex:[cellValue0 length] - 4]; NSString *pdfPath2 = [[NSBundle mainBundle] pathForResource:valuem ofType:@"mp3"]; NSURL *url = [NSURL fileURLWithPath:pdfPath2];

    Read the article

  • If url exists Objective-c

    - by HiGuy Smith
    Hey, I have a program that needs to tell if an online image exists, but the only way that I've gotten this to work is by loading the image in a NSData pointer and checking if the pointer exists. - (BOOL)exists { NSString *filePath = @"http://couleeapps.hostei.com/BottomBox.png"; NSURL *url = [NSURL URLWithString:filePath]; NSData *imageData = [NSData dataWithContentsOfURL:url]; if (imageData) { return YES; } return NO; } This has worked for me, but my problem is that I have a very slow connection, and it takes forever to download the image. So my question is: is there a way to check if a image (say "http://couleeapps.hostei.com/BottomBox.png") is available without having to download it? Help is much appreciated HiGuy

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >