Search Results

Search found 335 results on 14 pages for 'gary garside'.

Page 12/14 | < Previous Page | 8 9 10 11 12 13 14  | Next Page >

  • Error Building Project With NSXMLParserDelegate.

    - by fuzzygoat
    TurbineXMLParser.h #import <Foundation/Foundation.h> @interface TurbineXMLParser : NSObject <NSXMLParserDelegate> { ... TurbineXMLParser.m #import "TurbineXMLParser.h" I have just added a new class to my current project that I previously tested in a single file. When I try and build the project I get the error: error: cannot find protocol declaration for 'NSXMLParserDelegate' I did a bit of searching and tried adding the following ... TurbineXMLParser.h #import <Foundation/Foundation.h> @protocol NSXMLParserDelegate; @interface TurbineXMLParser : NSObject <NSXMLParserDelegate> { ... but still get the warning: warning: no definition of protocol 'NSXMLParserDelegate' is found any help would be much appreciated gary

    Read the article

  • Suppressing NSLog statements for release?

    - by fuzzygoat
    I wonder if someone could help me setup a number of NSLog statements so they print to console when executing in "Debug Mode" but don't print in "Release Mode". I understand I need to add something like DEBUG = 1 to the debug config in Xcode but I can't find where. Also how do I utilise this in my code? NSLog(@"Print Always"); if(DEBUG) NSLog(@"Print only in debug"); Is there a simple way of doing this? EDIT: I tried following this but when I entered either: OTHER_CFLAGS or GCC_PREPROCESSOR_DEFINITIONS Xcode informed me that "theres already another key named .... " gary

    Read the article

  • UITableView programatically create delegate object?

    - by fuzzygoat
    I have a question regarding setting up a custom delegate class for use with UITableView. What I have done is as follows: Setup a new class (in sperate *.h and *.m files for the class) Conformed that new class to the <UITableViewDelegate, UITableViewDataSource> protocols Added the required methods. Created a pointer to the new object using @property and IBOutlet. In InterfaceBuilder created and assigned an object template to my new class Assigned the dataSource and delegate connections. This all works fine. My question is if I don't want to use interfaceBuilder to setup and instantiate my new delegate class directly in Xcode how do I go about doing that? More specifically how would I: Instantiate the delegate class, would that be created / owned by the controller? Set the dataSource and delegate connections? What is the best way of doing this? any help / information is much appreciated. Gary

    Read the article

  • unarchiveObjectWithFile retain / autorelease needed?

    - by fuzzygoat
    Just a quick memory management question if I may ... Is the code below ok, or should I be doing a retain and autorelease, I get the feeling I should. But as per the rules unarchiveObjectWithFile does not contain new, copy or alloc. -(NSMutableArray *)loadGame { if([[NSFileManager defaultManager] fileExistsAtPath:[self pathForFile:@"gameData.plist"]]) { NSMutableArray *loadedGame = [NSKeyedUnarchiver unarchiveObjectWithFile:[self pathForFile:@"gameData.plist"]]; return loadedGame; } else return nil; } or -(NSMutableArray *)loadGame { if([[NSFileManager defaultManager] fileExistsAtPath:[self pathForFile:@"gameData.plist"]]) { NSMutableArray *loadedGame = [[NSKeyedUnarchiver unarchiveObjectWithFile:[self pathForFile:@"gameData.plist"]] retain]; return [loadedGame autorelease]; } else return nil; } gary

    Read the article

  • setDelegate:self, how does it work?

    - by fuzzygoat
    I have a query regarding how delegates work. My understanding was that delegates take responsibility for doing certain tasks on behalf of another object. locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; Am I right in thinking that in the example code above that the instance of CLLocationManager is created on a new thread so that it can get on with trying to find the location information it needs. When it completes its task (or encounters an error) it calls-back using the appropriate methods located in self e.g. locationManager:didUpdateToLocation:fromLocation: Essentially locationManager sends messages to self (which conforms to the correct delegate protocol) when things happen cheers gary

    Read the article

  • Outputing struct to NSLog for debugging?

    - by fuzzygoat
    I am just curious, is there a way to print via NSLog the contents of a struct? id <MKAnnotation> mp = [annotationView annotation]; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 350, 350); I am trying to output whats in [mp coordinate] for debugging. . EDIT_001: I cracked it, well unless there is another way. id <MKAnnotation> mp = [annotationView annotation]; CLLocationCoordinate2D location = [mp coordinate]; NSLog(@"LAT: %f LON: %f", location.latitude, location.longitude); many thanks gary

    Read the article

  • Declaring CustomViewController?

    - by fuzzygoat
    I have noticed in some of my older apps that in situations where I have added a custom View Controller I have not changed the View Controller class in the application delegate. For example, below I have created a CustomViewController class but have declared viewController as UIViewController. @interface ApplicationAppDelegate: NSObject <UIApplicationDelegate> { UIWindow *window; UIViewController *viewController; } My question is, both work, but for correctness should I be writing this as follows: @class CustomViewController; @interface ApplicationAppDelegate: NSObject <UIApplicationDelegate> { UIWindow *window; CustomViewController *viewController; } gary

    Read the article

  • Accessing XML data online?

    - by fuzzygoat
    I am just testing an app to get data off our web server, previously I had been using: NSURL, NSURLRequest, NSURLConnection etc. to get the data that I wanted. But I have just noticed that if I swap to using XML I can simply do the following and pass the results to NSXMLParser: NSURL *url = [NSURL URLWithString:@"https://www.fuzzygoat.com/turbine?nbytes=1&fmt=xml"]; Am I right in thinking that if your just after XML this is an acceptable method? It just seems strongly short compared to what I was doing before? gary

    Read the article

  • iPhone, Convenience Method or Alloc / Release?

    - by fuzzygoat
    Whilst developing for the iPhone I had a stubborn memory leak that I eventually tracked down to NSXMLParser. However whilst looking for that it got me thinking about maybe changing a lot of my convenience methods to alloc/release. Is there any good reason for doing that? In a large app I can see how releasing memory yourself quickly is a better idea, but in a small app is there any other difference between the two methods. NSNumber *numberToAdd = [NSNumber numberWithInt:intValue]; dostuff ... OR NSNumber *numberToAdd = [[NSNumber alloc] initWithInt:intValue]; doStuff ... [numberToAdd release]; cheers gary.

    Read the article

  • Selecting the most common value from relation - SQL statement

    - by Ronnie
    I have a table within my database that has many records, some records share the same value for one of the columns. e.g. | id | name | software | ______________________________ | 1 | john | photoshop | | 2 | paul | photoshop | | 3 | gary | textmate | | 4 | ade | fireworks | | 5 | fred | textmate | | 6 | bob | photoshop | I would like to return the value of the most common occurring piece of software, by using an SQL statement. So in the example above the required SQL statement would return 'photoshop' as it occurs more than any other piece of software. Is this possible? Thank you for your time.

    Read the article

  • iPhone Options for reading item from XML?

    - by fuzzygoat
    I am accessing this data from a web server using NSURL, what I am trying to decide is should I read this as XML or should I just use NSScanner and rip out the [data] bit I need. I have looked around the web for examples of extracting fields from XML on the iPhone but it all seems a bit overkill for what I need. Can anyone make any suggestions or point me in the right direction. In an ideal world I would really like to just specify [data] and get a string back "2046 3433 5674 3422 4456 8990 1200 5284" <!DOCTYPE tubinerotationdata> <turbine version="1.0"> <status version="1.0" result="200">OK</status> <data version="1.0"> 2046 3433 5674 3422 4456 8990 1200 5284 </data> </turbine> any comments / ideas are much appreciated. gary

    Read the article

  • MKReverseGeocoder delegate location?

    - by fuzzygoat
    I have a quick question regarding memory management that I am not quite sure about. I currently have a locationManager delegate that calls locationManager:didUpdateToLocation:fromLocation when it resolves the device location. My question is I am looking at adding ReverseGeoCoding after I have obtained the [newLocation coordinate] but am unsure about doing the alloc here, as each time locationManager:didUpdateToLocation:fromLocation gets called I will be alloc-ing a new MKReverseGeoCoder? // LOCATION -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { // GeoCoding: MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:[newLocation coordinate]]; [geoCoder setDelegate:self]; [geoCoder start]; [self foundLocation]; } Can anyone point me in the right direction with regards to this? I did try doing the alloc in application:didFinishLaunchingWithOptions: but then realised I did not have access to [newLocation coordinate]. many thanks gary

    Read the article

  • Xcode, changing applications subfolder?

    - by fuzzygoat
    Hi have noticed today whilst writing a simple iPhone app that Xcode sometimes starts a new folder in applications, whilst your still working on the same app. /Users/Fuzzygoat/Library/Application Support/iPhone Simulator/User/Applications/4E5EF4F0-F410-46A6-888C-0D23BB97D2DC Does anyone know what causes Xcode to swap to a new app folder (i.e. the one named "4E5EF4F0-F410-46A6-888C-0D23BB97D2DC") EDIT_001: One thing I have noticed is that I have been doing a lot of quitting an application and restarting to check a set of archive methods, and that does tend to confuse it sometimes. A couple of times it has not found saved data, I guess this is just a side effect of constantly running the simulator over and over via Xcode. Things seem to go just fine if I test on the Simulator without Xcode, for a start the folder keeps the same name. NB: I am using NSSearchPathForDirectoriesInDomains to get the documents folder each time. gary

    Read the article

  • AppDelegate viewController memory leak?

    - by fuzzygoat
    I am just curious with regards to the correct way to create a view controller programatically. When I compile this code with the static analyser I get a leak (as you would expect) from the alloc. Should I just leave it as it needs to stay until the app exits anyways, or is there a cleaner way? - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSLog(@"UIApplication application:"); RectViewController *myController = [[RectViewController alloc] init]; [window addSubview:[myController view]]; [window makeKeyAndVisible]; return YES; } cheers Gary

    Read the article

  • Block declared variable visible outside?

    - by fuzzygoat
    If I declare a variable within a block (see below) is there a way to specify that its visible outside the block if need be? if(turbine_RPM > 0) { int intResult = [sensorNumber:1]; NSNumber *result = [NSNumber numberWithInt:intResult]; } return result; or is the way just to declare outside the block scope? NSNumber *result; if(turbine_RPM > 0) { int intResult = [sensorNumber:1]; result = [NSNumber numberWithInt:intResult]; } return result; many thanks gary

    Read the article

  • How to load object after saving with encodeWithCoder?

    - by fuzzygoat
    EDIT_002: Further rewrite: if I save using the method below how would the method to load it back in look? (moons is an NSMutableArray of NSNumbers) // ------------------------------------------------------------------- ** // METHOD_002 // ------------------------------------------------------------------- ** -(void)saveMoons:(NSString *)savePath { NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [moons encodeWithCoder:archiver]; [archiver finishEncoding]; [data writeToFile:savePath atomically:YES]; [archiver release]; [data release]; } EDIT_003: Found it, my problem was that I was using ... [moons encodeWithCoder:archiver]; where I should have been using ... [archiver encodeObject:moons]; Hence the loader would look like: -(void)loadMoons_V3:(NSString *)loadPath { NSData *data = [[NSData alloc] initWithContentsOfFile:loadPath]; NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data]; [self setMoons:[unarchiver decodeObject]]; [unarchiver finishDecoding]; [unarchiver release]; [data release]; } gary

    Read the article

  • Preload *.wav with SystemSoundID?

    - by fuzzygoat
    I am playing a wav file to give a little audio feedback when a button in my UI is pressed. My question is when you first press the button there is a delay (about 1.5secs) whilst the sound file "sound.wav" is loaded and cached. Is there a way to pre-cache this file (maybe in my viewDidLoad)? I guess I could do it by just playing it a viewDidLoad, but would really need to disable the audio so it does not "beeb" each time the app starts. many thanks for and help. gary EDIT: Looks like my question is a duplicate of this post unless anyone has any new info? Maybe a way to turn the play volume down temporarily, unless the audio is cleared each time through the run loop.

    Read the article

  • Releasing instance if service not enabled?

    - by fuzzygoat
    I would just like to check if I have this right, I am creating an instance of CCLocationManager and then checking if location services are enabled. If it is not enabled I then report an error, release the instance and carry on, does that look/sound right? locationManager = [[CLLocationManager alloc] init]; BOOL supportsService = [locationManager locationServicesEnabled]; if(supportsService) { [locationManager setDelegate:self]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; } else { NSLog(@"Location services not enabled."); [locationManager release]; } ... ... ... more code cheers gary

    Read the article

  • @synthesize with UITabBarController?

    - by fuzzygoat
    I am curious if there is a good reason I should / should not be using @synthesize for the tabBarController below, or does it not matter? @implementation ScramAppDelegate @synthesize window; @synthesize tabBarController; -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self setTabBarController:[[UITabBarController alloc] init]]; [window addSubview:[tabBarController view]]; [window makeKeyAndVisible]; return YES; } -(void)dealloc { [tabBarController release]; [self setTabBarController: nil]; [window release]; [super dealloc]; } OR @implementation ScramAppDelegate @synthesize window; -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { tabBarController = [[UITabBarController alloc] init]; [window addSubview:[tabBarController view]]; [window makeKeyAndVisible]; return YES; } -(void)dealloc { [tabBarController release]; [window release]; [super dealloc]; } cheers Gary

    Read the article

  • @property, setter and getter question?

    - by fuzzygoat
    NSString *statusValue; NSString *currentValue; @property(retain, nonatomic) NSString *statusValue; @property(retain, nonatomic) NSString *currentValue; @synthesize statusValue; @sythnesize currentValue; Given the above, if I am setting one variable to another is it work doing ... [self setStatusValue: currentValue]; or should I use the property again and use [self setStatusValue: [self currentValue]]; I suppose the latter (although maybe overkill) does tell the reader that we are using one of the objects instance variables and not some local variable. just curious really ... gary

    Read the article

  • iPhone, confusing memory leak.

    - by fuzzygoat
    Can anyone tell me what I am doing wrong with the bottom section of code. I was sure it was fine but "Leaks" says it is leaking which quickly changing it o the top version stops, just not sure as to why the bottom variation fails? // Leaks says this is OK if([elementName isEqualToString:@"rotData-requested"]) { int myInt = [[self elementValue] intValue]; NSNumber *valueAsNumber = [NSNumber numberWithInt:myInt]; [self setRotData:valueAsNumber]; return; } . // Leaks says this LEAKS if([elementName isEqualToString:@"rotData-requested"]) { NSNumber *valueAsNumber = [NSNumber numberWithInt:[[self elementValue] intValue]]; [self setRotData:valueAsNumber]; return; } any help would be appreciated. gary

    Read the article

  • UITableView setting standalone delegate object?

    - by fuzzygoat
    Hi have setup a sample application using a UITableView. Initially I did this by conforming my controller to and , added a tableView in IB and connected "datasource" & "delegate" to Files Owner. It all works so thats good. What I have been trying out is creating my own class for the delegate. I created a new class and added and , but quickly found I could not connect the tableViewdataSource / delegate. To solve this I added an "Object" (NSObject) in IB and set it to my new class. I then connected the dataSource and delegate outlets to this object. It sort of works, the app runs and displays the tableView, but when I try and scroll the table the app crashes. Can I ask if I am going about this the right way? gary

    Read the article

  • Silverlight MVVM example which does not use data grids?

    - by Aim Kai
    I was wondering if anyone knew of a great example of using the MVVC pattern for a Silverlight application that does not utilise a data grid? Most of the examples I have read see links below and books such as Pro WPF and Silverlight MVVM by Gary Hall use a silverlight application with a datagrid. Don't get me wrong, these are all great examples. See also: MVVM: Tutorial from start to finish? http://www.silverlight.net/learn/tutorials/silverlight-4/using-the-mvvm-pattern-in-silverlight-applications/ However some recent demo projects I have been working are not necessarily dealing with data grids but I would still want to implement this pattern..

    Read the article

  • Xcode, Dev Docs Search Field Loosing Focus?

    - by fuzzygoat
    I am having a strange issue with the developer documentation (which i have only noticed after installing Xcode 3.2.3). My problem is that as you type in the search field (upper right) it looses focus and immediately starts looking for the first few letters you type. For example if you looking for "NSObject" you start typing "NSO" and as you type the field looses focus the last 5 characters "bject" just give beeps as you need to reselect the field to type extra characters. Has anyone else come across this or know what the problem might be? cheers Gary.

    Read the article

  • Simple ViewController / View, remove white bar?

    - by fuzzygoat
    I am just looking at setting up a simple viewController programatically, I have a ViewController.xib file that I have set the background color to RED in interface builder. I have also added the following to my AppDelegate.m @implementation syntax_MapViewAppDelegate @synthesize window; -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { viewController = [[MapViewController alloc] init]; [window addSubview:[viewController view]]; [window makeKeyAndVisible]; return YES; } -(void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end When I run the code it does what I expect apart from the white bar at the bottom of the screen, can anyone give me any pointers in how to remove this? I have a feeling I might need to position the view within the window, but I am not sure how? cheers Gary

    Read the article

< Previous Page | 8 9 10 11 12 13 14  | Next Page >