titleForHeaderInSection wrong section count.
I have a fetch let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: getManagedObjectContext(), sectionNameKeyPath:"product.sectionKey", cacheName:nil) In the following function: func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { print(section) print (searchFetchedResultsController.sectionIndexTitles) I see: 30 ["1", "2", "4", "8", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] Yes there are 30 elements but the array is zero based. What is happening here? Thanks James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to turn of the Journal logging of CoreData/Sqlite?
What is the magic combination of options to send to the sqlite to completely turn off journaling. I have an initialization on install that brings down a lot of data. I don’t need journaling at this point and it balloons the memory storage upon install to over 500MB! I have tried: var options = Dictionary() options[NSMigratePersistentStoresAutomaticallyOption] = true options[NSInferMappingModelAutomaticallyOption] = true options[NSSQLitePragmasOption] = ["journal_mode" : "TRUNCATE”] or options[NSSQLitePragmasOption] = ["journal_mode" : “OFF"] or options[NSSQLitePragmasOption] = ["journal_mode" : “DELETE”] and options[NSSQLiteManualVacuumOption] = true even options[NSSQLitePragmasOption] = ["journal_size_limit" : "2”] by : do { _ = try self.managedObjectStore!.addSQLitePersistentStoreAtPath(storePath, fromSeedDatabaseAtPath: nil, withConfiguration: nil, options: options) } catch let error as NSError { print("fail to add persistent store") print(error) } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to turn of the Journal logging of CoreData/Sqlite?
This is only at the install. The WAL file grows to over 500MB. Then when the app is restarted this WAL file is truncated and app goes down to about 35MB. I don’t know enough about sqlite and how it will handle the situation of when there is only 400MB left on the device. Basically I am using RestKIT bridged into my SWIFT application. This is using RestKIT api pretty straight out of the box stuff. > On Apr 6, 2016, at 10:27 AM, Jens Alfke wrote: > > >> On Apr 6, 2016, at 7:43 AM, James Cicenia > <mailto:ja...@jimijon.com>> wrote: >> >> What is the magic combination of options to send to the sqlite to completely >> turn off journaling. >> I have an initialization on install that brings down a lot of data. I don’t >> need journaling at this point >> and it balloons the memory storage upon install to over 500MB! > > Journaling doesn’t affect memory usage, except in the ‘memory’ mode or if the > database is entirely in-memory, both of which seem unlikely for Core Data. I > would imagine that Core Data uses the WAL mode since it’s significantly more > efficient than the older journaling modes. > > If you’re seeing high memory utilization, it’s more likely something to do > with Core Data itself. It might be a symptom of a way you’re misusing Core > Data, but my knowledge of that API is very old and rusty so I don’t have any > advice there. > > Have you tried using Instruments or the ‘heap’ tool to look at allocation > patterns when this occurs? You should be able to tell the difference between > SQLite allocations (which will be anonymous malloc blocks) and Core Data > allocations (which will be Obj-C objects.) > > —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why doesn't my Swift method get called.
I added a swift file to my project. I wanted to use an open source sidebar. I have checked my targets, etc. Xcode compiles, builds and runs my code without a problem. But when I debug it, it just goes over and never into the method. Why would it do that? It builds and compiles, and even if I click the method it takes me to it so it is seeing it. Is there an Xcode setting I am missing? Thank you James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't my Swift method get called.
Hmm, I had a bad UIImage(named: "menu-new”) should have been menu-news as an array element in the parameter. > On Jun 17, 2015, at 9:09 AM, Dave wrote: > > What happens when you put a breakpoint in the method, rather then trying to > step into it? > >> On 17 Jun 2015, at 14:47, James Cicenia wrote: >> >> I added a swift file to my project. I wanted to use an open source sidebar. >> >> I have checked my targets, etc. >> Xcode compiles, builds and runs my code without a problem. But when >> I debug it, it just goes over and never into the method. >> >> Why would it do that? It builds and compiles, and even if I click the >> method it takes me to it so it is seeing it. >> >> Is there an Xcode setting I am missing? >> >> Thank you >> James > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com > > This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Button Image Behavior
Hello - I am trying to toggle a button with three states. In IB I have it set to “off” In the code I toggle as such: func toggleStatus() { if(product.favorite == false && product.avoid == false){ product.favorite = true product.avoid = false favoriteButton.setImage(UIImage(named: "Favorites-On"), forState: .Normal) }else if(product.favorite == true && product.avoid == false){ product.favorite = false product.avoid = true favoriteButton.setImage(UIImage(named: "Avoids-On"), forState: .Normal) }else { product.favorite = false product.avoid = false favoriteButton.setImage(UIImage(named: "Favorites-Off"), forState: .Normal) } } When my screen comes up it is correctly in the off state. When I touch it, it correctly goes to Favorites-On When I touch it again, it correctly goes to Avoids-On HOWEVER, when I next touch it, it briefly shows “Favorites-On” before going to “Favorites-Off” Why is it flashing like that? Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Moving from nib to code with custom controller.
Hello - I have always used IB before. I added my controller and linked it all up and it worked great. Now, I have to move this instead to code. I am confused on how to do this. 1) I have a custom view controller. (FeaturedViewController) 2) I have a UIScrollView (FeaturedScrollView) 3) I normally linked it up with IB scrollView = FeaturedViewController delegate = FeaturedViewController view = FeaturedViewController. SO.. How do I set this up in my init of my master Controller (HomePageController) Thank you very much James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Predicates not fetching.
Hello - I first read an xml file upon startup into a Core Data sqlite. I then fetch all records... they are there. I then do a simple predicate @"name == %@", nameString If find nothing. And it is there. Now if I open the created SQLITE database via a client tool, It also turns up zero records. However if I do a like construct in SQL I can get it to return records. name like nameString% However, if I do a like via my predicate, still no records. I am using the same context throughout. My xml was dead simple as in: 8 Buddha There are no hidden characters, etc. Any thoughts? This is driving me a bit crazy Thanks James smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
ALAssetsLibrary and iOS5
Hello - My code now for gathering images from the photo library seems to always timeout the library instance. How can I not? Nothing I have tried works. I am using the ELCAlbumPickerController code which used to work great: dispatch_async(dispatch_get_main_queue(), ^ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Group enumerator Block void (^assetGroupEnumerator)( ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) { if (group == nil) { return; } [self.assetGroups addObject:group]; NSLog(@"count: %d", [group numberOfAssets]); // Reload albums [self performSelectorOnMainThread:@selector(reloadTableView) withObject:nil waitUntilDone:YES]; }; // Group Enumerator Failure Block void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) { UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Album Error: %@", [error description]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; [alert release]; NSLog(@"A problem occured %@", [error description]); }; NSMutableArray *tempArray = [[NSMutableArray alloc] init]; self.assetGroups = tempArray; [tempArray release]; // Enumerate Albums ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init]; [library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:assetGroupEnumerator failureBlock:assetGroupEnumberatorFailure]; [library release]; [pool release]; }); Anyone get this working properly? Thanks james smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ALAssetsLibrary and iOS5
Thanks... found the answer in the developer forum. The Library had to be initialized in AppDelegate (singleton). thanks On Oct 29, 2011, at 1:46 AM, Sandy McGuffog wrote: > Just looking at the code, one issue that you might be running into is that > for ALAssetsLibrary under iOS 5, to quote from the Apple docs, "The lifetimes > of objects you get back from a library instance are tied to the lifetime of > the library instance." In this case, it's not at all clear to me that this > restriction is being met. There are a couple of threads on the Apple > developer forum discussing this. > > Sandy > > On Oct 27, 2011, at 6:36 PM, James Cicenia wrote: > >> ALAssetsLibrary > smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Works in 4.1 but not 4.2 ...
((PersonaDetailView*)self.view).controller = self; This fails at runtime but only in 4.2. Why ? It doesn't sense the typecast and thinks it is only a UIView. Thanks James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Works in 4.1 but not 4.2 ...
hmm, yes... but still it works with my XCode3.2.4 with 4.1 vs now with 3.3.5 and 4.2 2010-12-02 06:11:40.705 CoinStar[31673:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setController:]: unrecognized selector sent to instance 0x9814950' *** Call stack at first throw: ( 0 CoreFoundation 0x01b7fbe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x01cd45c2 objc_exception_throw + 47 2 CoreFoundation 0x01b816fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x01af1366 ___forwarding___ + 966 4 CoreFoundation 0x01af0f22 _CF_forwarding_prep_0 + 50 5 CoinStar0x000e4006 -[PersonaDetailViewController viewDidLoad] + 69 6 UIKit 0x00a6165e -[UIViewController view] + 179 7 CoinStar0x00039d68 -[RootViewController visibleMosaic] + 214 8 CoinStar0x00030c12 -[FillHomeScreenService fillHomeScreen:] + 60 9 CoinStar0x00010de4 -[BasicService invokeWithArgs:] + 125 10 CoinStar0x00010af5 -[ServiceRegistry invokeService:withArgs:] + 99 11 CoinStar0x00010c86 +[ServiceRegistry invokeService:withArgs:] + 79 12 CoinStar0x00045614 -[WonderbarView setViewState:animated:] + 424 13 CoinStar0x000453d1 -[WonderbarView setViewState:] + 51 14 CoinStar0x000445f7 -[WonderbarView didMoveToWindow] + 328 Thanks On Dec 2, 2010, at 6:03 AM, Roland King wrote: > Runtime doesn't care about casts, you have what you have, it is what it is, > that cast only shuts up the compiler. > > What's the real error and real code. > > On 02-Dec-2010, at 7:56 PM, James Cicenia wrote: > >> ((PersonaDetailView*)self.view).controller = self; >> >> This fails at runtime but only in 4.2. Why ? >> >> It doesn't sense the typecast and thinks it is only a UIView. >> >> Thanks >> James >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org >> >> This email sent to r...@rols.org > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Works in 4.1 but not 4.2 ...
Yes .. but why did it like it prior to my upgrade? Hmmm, let me check the NIB. I realized that was what was wrong.. somewhere it is not getting PersonaDetailView. Thanks James On Dec 2, 2010, at 6:26 AM, Roland King wrote: > ok. so UIView doesn't have a setController method (according to my developer > docs) and you're sending it that message so it doesn't like it. Can I assume > that setController is a method you defined on PersonaDetailView? If so it > seems the thing you're sending it to isn't actually a PersonaDetailView, > it's just a plain old common or garden UIView. in PersonaDetailView > viewDidLoad what object are you actually sending that message to, where does > it come from? You're expecting self.view to be a PersonaDetailView* but it's > not, it's just a UIView .. have you checked the NIB and possibly forced it to > recompile? > > On 02-Dec-2010, at 8:12 PM, James Cicenia wrote: > >> hmm, yes... but still it works with my XCode3.2.4 with 4.1 vs now with 3.3.5 >> and 4.2 >> >> >> 2010-12-02 06:11:40.705 CoinStar[31673:207] *** Terminating app due to >> uncaught exception 'NSInvalidArgumentException', reason: '-[UIView >> setController:]: unrecognized selector sent to instance 0x9814950' >> *** Call stack at first throw: >> ( >> 0 CoreFoundation 0x01b7fbe9 >> __exceptionPreprocess + 185 >> 1 libobjc.A.dylib 0x01cd45c2 objc_exception_throw >> + 47 >> 2 CoreFoundation 0x01b816fb -[NSObject(NSObject) >> doesNotRecognizeSelector:] + 187 >> 3 CoreFoundation 0x01af1366 ___forwarding___ + >> 966 >> 4 CoreFoundation 0x01af0f22 >> _CF_forwarding_prep_0 + 50 >> 5 CoinStar0x000e4006 >> -[PersonaDetailViewController viewDidLoad] + 69 >> 6 UIKit 0x00a6165e -[UIViewController >> view] + 179 >> 7 CoinStar0x00039d68 -[RootViewController >> visibleMosaic] + 214 >> 8 CoinStar0x00030c12 >> -[FillHomeScreenService fillHomeScreen:] + 60 >> 9 CoinStar0x00010de4 -[BasicService >> invokeWithArgs:] + 125 >> 10 CoinStar0x00010af5 -[ServiceRegistry >> invokeService:withArgs:] + 99 >> 11 CoinStar0x00010c86 +[ServiceRegistry >> invokeService:withArgs:] + 79 >> 12 CoinStar0x00045614 -[WonderbarView >> setViewState:animated:] + 424 >> 13 CoinStar0x000453d1 -[WonderbarView >> setViewState:] + 51 >> 14 CoinStar0x000445f7 -[WonderbarView >> didMoveToWindow] + 328 >> >> >> Thanks >> >> On Dec 2, 2010, at 6:03 AM, Roland King wrote: >> >>> Runtime doesn't care about casts, you have what you have, it is what it is, >>> that cast only shuts up the compiler. >>> >>> What's the real error and real code. >>> >>> On 02-Dec-2010, at 7:56 PM, James Cicenia wrote: >>> >>>> ((PersonaDetailView*)self.view).controller = self; >>>> >>>> This fails at runtime but only in 4.2. Why ? >>>> >>>> It doesn't sense the typecast and thinks it is only a UIView. >>>> >>>> Thanks >>>> James >>>> >>>> ___ >>>> >>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>>> >>>> Please do not post admin requests or moderator comments to the list. >>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>> >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org >>>> >>>> This email sent to r...@rols.org >>> >> >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org >> >> This email sent to r...@rols.org > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data won't accept this string...
Hello - I am trying to import data into Core Data. I am trying to set the value of one the attributes to the following string: MeasureID = 2376; Property = { root = { ExtendedProperties = { item = { "@id" = PhotoRequired; text = 0; }; }; }; }; It takes the MeasureID but no matter what I do it won't take the String in Property? And worse, the following code: [self setValue:value forKey:attribute]; Just swallows it and doesn't throw any errors ? Is the fact that it looks like an array or dictionary throwing off NSManagedObject? Banging my head, James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data won't accept this string...
Thank you for taking the time to answer. Sorry about the declarative question mark. I guess I just needed a sanity check. I inherited a NSManagedObject category that was being too aggressive in converting everything to Dictionary. So, I turned that value back into an NSString and it worked. Thank you for your time. - j- On Apr 3, 2012, at 1:18 PM, Fritz Anderson wrote: > On 3 Apr 2012, at 12:11 PM, James Cicenia wrote: > >> I am trying to import data into Core Data. I am trying to set the value of >> one the attributes to the following string: >> >> MeasureID = 2376; >> Property = { >> root = { >> ExtendedProperties = { >> item = { >> "@id" = PhotoRequired; >> text = 0; >> }; >> }; >> }; >> }; > > This appears to be a text property list, almost. You don't include the outer > brace pair. How do you read this "string," and how are you applying it to a > managed object? > >> It takes the MeasureID but no matter what I do it won't take the String in >> Property? > > What "takes" it? The managed object? > >> And worse, the following code: [self setValue:value forKey:attribute]; Just >> swallows it and doesn't throw any errors ? > > What is "value?" How is it obtained? Have you examined it in the debugger (or > through an NSLog()) to verify it isn't nil? > >> Is the fact that it looks like an array or dictionary throwing off >> NSManagedObject? > > Nothing in Cocoa interprets plist data unless you explicitly put it through a > serializer, such as the array- or dictionary-with-contents-of-file > initializers or the NSPropertyListSerialization class. > > But you apparently want Measure/Property to be interpreted as dictionary > key/value pairs (net of the absence of enclosing braces), but you don't want > to interpret the dictionary assigned to Property. The deserializers don't > work that way; they convert the nested structures to arrays and dictionaries > all the way down. > > You'll have to show us your actual code. What's happening depends on what > you're actually doing, and a narrative description of what you meant to do > doesn't tell us enough to know what you did. > > And please don't tack question marks onto the ends of declarative sentences. > > — F > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPhone - AddressBook Question
Hello - I am new to iPhone and Cocoa, but, am definitely enjoying learning it. Anyway, I was wondering if it was possible for my application to have its own separate address book? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Newbie Question on a method signature
I have the following: ((ProjectListCell *)cell).budgetHealth.textColor = [self returnUIColorForFont:s]; And here is my method: - (UIColor *) returnUIColorForFont:(NSString *) theString{ if([theString compare:@"1"] == NSOrderedSame){ return [UIColor greenColor]; }else if([theString compare:@"0"] == NSOrderedSame){ return [UIColor yellowColor]; }else if([theString compare:@"-1"] == NSOrderedSame){ return [UIColor redColor]; }else{ return [UIColor grayColor]; } } why does it tell me: warning: (Messages without a matching method signature will be assumed to return 'id' and accept... Thank you James Cicenia t T T ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question on a method signature
Wow.. I didn't know the order of methods was important. thanks James On Jun 4, 2008, at 3:20 PM, Hamish Allan wrote: On Wed, Jun 4, 2008 at 9:14 PM, James Cicenia <[EMAIL PROTECTED]> wrote: why does it tell me: warning: (Messages without a matching method signature will be assumed to return 'id' and accept... I'm guessing your method's definition comes after the code that uses that method, and you haven't declared it in the header file. Hamish ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question on a method signature
OK - When I put the method ahead of the call it compiled and work. So I decided to declare it in my header as: - (UIColor *) returnUIForFont: (NSString *) theString; Now the compiler complains: /Users/jcicenia/Documents/iPhone/TOSPhone/ProjectViewController.m:142: warning: incomplete implementation of class 'ProjectViewController' /Users/jcicenia/Documents/iPhone/TOSPhone/ProjectViewController.m:142: warning: method definition for '-returnUIForFont:' not found What the heck is wrong with my declaration? Thanks James Wh On Jun 4, 2008, at 3:22 PM, Michael Vannorsdel wrote: You have to make sure your header has - (UIColor *) returnUIColorForFont:(NSString *) theString in it so when you use the method in other source files the compiler will know what the arguments and return types to returnUIColorForFont: are. Without this the compiler has to make assumptions and is warning you that it is doing so. Also, to compare if strings are equal you can just do: if([theString isEqualToString:@"1"]) //do stuff Just another shorter method eventhough the way you're doing it is perfectly fine. On Jun 4, 2008, at 2:14 PM, James Cicenia wrote: I have the following: ((ProjectListCell *)cell).budgetHealth.textColor = [self returnUIColorForFont:s]; And here is my method: - (UIColor *) returnUIColorForFont:(NSString *) theString{ if([theString compare:@"1"] == NSOrderedSame){ return [UIColor greenColor]; }else if([theString compare:@"0"] == NSOrderedSame){ return [UIColor yellowColor]; }else if([theString compare:@"-1"] == NSOrderedSame){ return [UIColor redColor]; }else{ return [UIColor grayColor]; } } why does it tell me: warning: (Messages without a matching method signature will be assumed to return 'id' and accept... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Newbie Memory Questions on a Code Fragment
Hello - I am new to iphone and objective-c etc. Here is some code I wrote for the appdelegate to initialize some dictionaries and arrays: My main question has to do with memory and releasing it. In my app I will need listOfMonthNames for my popups and will also need dictionaryOfProduceTypes to populate other dependent popups. thanks James -(void)initializeArraysAndDictionaries { if(!listOfMonthNames){ NSArray *listOfMonthNamesTmp = [[NSArray alloc] initWithObjects: @"January ",@"February ",@"March ",@"April ",@"May ",@"June ",@"July",@"August",@"September",@"October",@"November",@"December"]; // enumerate over items printf( "static array\n" ); [listOfMonthNames arrayByAddingObjectsFromArray:listOfMonthNames2]; // free memory [listOfMonthNamesTmp release]; } if(!dictionaryOfProduceTypes){ // Create a distinct dictionary of types that hold an array of subtypes per type. // Types and subtypes are attributes of the ProduceItem object dictionaryOfProduceTypes = [[NSMutableDictionary alloc] init]; NSEnumerator *en = [produceItems objectEnumerator]; ProduceItem *item = nil; while (item = [en nextObject]) { if(![dictionaryOfProduceTypes objectForKey:item.type]){ //Doesn't exist yet, so allocate and initialize [dictionaryOfProduceTypes takeValue:[[NSMutableArray alloc] init] forKey:item.type]; } NSMutableArray *subtypes = [dictionaryOfProduceTypes objectForKey:item.type]; //Get the array then iterate through to see if we need to add a new subtype to be added NSEnumerator *en2 = [subtypes objectEnumerator]; NSString *subtype = nil; BOOL found = FALSE; while (subtype = [en2 nextObject]) { if([subtype compare:item.subtype]){ found = TRUE; break; } } if(!found){ [subtypes addObject:item.subtype]; } [dictionaryOfProduceTypes takeValue:subtypes forKey:item.type]; [subtypes release]; } [dictionaryOfProduceTypes release]; } } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Newbie Memory Questions on a Code Fragment
Thanks that helped a lot and clarified something I suspected. James On Jan 21, 2009, at 9:07 AM, Kenneth Bruno II wrote: On Jan 21, 2009, at 9:23 AM, James Cicenia wrote: Here is some code I wrote for the appdelegate to initialize some dictionaries and arrays: My main question has to do with memory and releasing it. In my app I will need listOfMonthNames for my popups and will also need dictionaryOfProduceTypes to populate other dependent popups. ... -(void)initializeArraysAndDictionaries { if(!listOfMonthNames){ NSArray *listOfMonthNamesTmp = [[NSArray alloc] initWithObjects: @"January ",@"February ",@"March ",@"April ",@"May ",@"June ",@"July",@"August",@"September",@"October",@"November",@"December"]; // enumerate over items printf( "static array\n" ); [listOfMonthNames arrayByAddingObjectsFromArray:listOfMonthNames2]; // free memory [listOfMonthNamesTmp release]; First of all, you probably should just use the localized list of month names that you can get through NSDateFormatter: NSDateFormatter *aFormatter = [NSDateFormatter new]; NSArray *listOfMonthNames = [[aFormatter standaloneMonthSymbols] retain]; This will give you an NSArray populated with NSString objects that contain the localized month names in the proper order. Notice that I retained the NSArray object. I did this because it is given to me autoreleased so if I want to own it I need to retain it. When I no longer need it I'll just call release on the object, this would most likely be done in the dealloc method of the class in which I initialized my object. if(!dictionaryOfProduceTypes){ // Create a distinct dictionary of types that hold an array of subtypes per type. // Types and subtypes are attributes of the ProduceItem object dictionaryOfProduceTypes = [[NSMutableDictionary alloc] init]; ... [dictionaryOfProduceTypes release]; } By releasing the dictionaryOfProduceTypes object you are giving up control of the object and allowing it to be deallocated. This means that the object that you just initialized won't be around when you need it. You want to only call release when you are 100% sure that you won't need the object any more or when you are cleaning up, such as in the dealloc method for a class. NSMutableArray *subtypes = [dictionaryOfProduceTypes objectForKey:item.type]; ... [subtypes release]; The objecForKey method returns an autoreleased NSArray. This means that its retain count is greater than zero for now, but it will be decremented to zero at some point in the future. By calling release on this object you are causing it to be over-released and even worse this will happen at some apparently random time in the future. You should only call release on objects that you have created through methods that begin with alloc, new, or copy or objects that you have previously called retain upon. I suggest that you review the Cocoa Memory Management Rules to understand this further: <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
sqlite iphone question....
Hello - I am trying to get my simulator to work with sqlite and was wondering if I was missing some step? Here is a snippet of code: - (void)initializeDatabase { NSMutableArray *items = [[NSMutableArray alloc] init]; self.produceItems = items; [items release]; // The database is stored in the application bundle. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sqlite"]; // Open the database. The database was prepared outside the application. if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { NSLog(@"Open Database"); // Get the primary key for all produce. const char *sql = "SELECT id FROM Item"; sqlite3_stmt *statement; // Preparing a statement compiles the SQL query into a byte- code program in the SQLite library. // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator. if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { NEVER GETS PAST THIS IF. I have queried the database and the data is in there?! Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SQLite Math Functions?
Does anyone know if sqlite on the iphone has math functions? thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: sqlite iphone question....
Hmmm,,, newbie here.. Where is the "sandbox? Thanks James On Jan 23, 2009, at 11:39 AM, Keary Suska wrote: On Jan 23, 2009, at 10:30 AM, James Cicenia wrote: - (void)initializeDatabase { NSMutableArray *items = [[NSMutableArray alloc] init]; self.produceItems = items; [items release]; // The database is stored in the application bundle. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sqlite"]; // Open the database. The database was prepared outside the application. if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { NSLog(@"Open Database"); // Get the primary key for all produce. const char *sql = "SELECT id FROM Item"; sqlite3_stmt *statement; // Preparing a statement compiles the SQL query into a byte- code program in the SQLite library. // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator. if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { NEVER GETS PAST THIS IF. I have queried the database and the data is in there?! Working with files in the app bundle like this may be a non-no. At least, it is for Mac OS X, and the emulator might have this issue. To know for sure, put the database file into the "sandbox" and see if it behaves better there. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: sqlite iphone question....
thanks On Jan 23, 2009, at 11:59 AM, mmalc Crawford wrote: On Jan 23, 2009, at 9:52 AM, James Cicenia wrote: Where is the "sandbox? <http://developer.apple.com/iphone/library/codinghowtos/DataManagement/index.html#FILE_MANAGEMENT-WRITE_INFORMATION_LOCALLY > mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: sqlite iphone question....
Hmmm,,, OK I read the docs a bit.. and now I am confused. This code snippet was basically copied and pasted from the sqlbook example. It works when I run it in the simulator. Mine .. .does get past the open database, but doesn't really get past the select. I also don't quite understand where I should set or copy mydatabase.sqlite. It is in the Resource group and in the target already. Confused James Cicenia On Jan 23, 2009, at 11:39 AM, Keary Suska wrote: On Jan 23, 2009, at 10:30 AM, James Cicenia wrote: - (void)initializeDatabase { NSMutableArray *items = [[NSMutableArray alloc] init]; self.produceItems = items; [items release]; // The database is stored in the application bundle. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sqlite"]; // Open the database. The database was prepared outside the application. if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { NSLog(@"Open Database"); // Get the primary key for all produce. const char *sql = "SELECT id FROM Item"; sqlite3_stmt *statement; // Preparing a statement compiles the SQL query into a byte- code program in the SQLite library. // The third parameter is either the length of the SQL string or -1 to read up to the first null terminator. if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { NEVER GETS PAST THIS IF. I have queried the database and the data is in there?! Working with files in the app bundle like this may be a non-no. At least, it is for Mac OS X, and the emulator might have this issue. To know for sure, put the database file into the "sandbox" and see if it behaves better there. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
IntefaceBuilder IPhone TableView Size Question
Hello - I am struggling a bit with learning Interface builder and am trying to design my view with the following structure: Top half, some pull down selectors. Bottom half the list of items matching the above selectors. I was now trying forever to resize the tableview when I drag it over to my window. But no matter what I can't seem to just shrink it and move it to the bottom half of my window. And the x and y boxes are grayed out no matter what I seem to do. Is this even possible? Am I missing a switch? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IntefaceBuilder IPhone TableView Size Question
I am actually using UITableView being an iPhone app. Even if I change it to UIScrollView, I just can't seem to make it do anything but resize around it center point and with no subsequent way to then move it down. Thanks - j- On Jan 27, 2009, at 12:51 PM, Fritz Anderson wrote: On 27 Jan 2009, at 8:37 AM, James Cicenia wrote: I was now trying forever to resize the tableview when I drag it over to my window. But no matter what I can't seem to just shrink it and move it to the bottom half of my window. And the x and y boxes are grayed out no matter what I seem to do. Are you trying to resize the NSTableView? You should be working with the enclosing NSScrollView (which is easy to forget about, because the library shows a "table view," but what you drag out of it is a hierarchy rooted in a scroll view). Change the NIB-contents window to hierarchical view, and use that list to select the scroll view. — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/ > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Memory Question on returning a View
Hello - I have the example code: Can I do this.. return a view and it will stick around? Thanks James Cicenia -(UIView *)mapViewForMonthAndType:(NSString *) pMonth type:(NSString) pType{ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; NSEnumerator *itemEnum = [availabilityArray objectEnumerator]; AvailableItem *item = nil; UIImageView *stateView = [[UIImageView alloc]initWithFrame:CGRectMake(0,0, 320, 220)]; [stateView setImage: [UIImage imageNamed:@"wf-map-back.png"]]; return stateView; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
simple memory management question
Hello - I have the following snippet: - (void)stateAction:(id)sender{ StatePickViewController *spvc = [[StatePickViewController alloc]initWithNibName:@"StatePicker" bundle:nil]; [spvc setMyParentController:self]; [spvc setDialogView:fruitTypeView]; [spvc viewWillAppear:TRUE]; [fruitTypeView addSubview:spvc.view]; } Now I thought I should put [spvc autorelease] at the end, but then my view won't show. Aren't I supposed to release spvc ? And if not, why not? Thanks James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
noobie mem management problem
Hello - I am confused. In .h : NSMutableArray *currentStates; @property (nonatomic, copy) NSMutableArray *currentStates; Now in my appdelegate I have: @synthesize currentStates; then in a method: while (sqlite3_step(statement) == SQLITE_ROW) { char *str = (char *)sqlite3_column_text(statement, 0); [self.currentStates addObject:(str) ? [NSString stringWithUTF8String:str] : @""]; } However currentStates never gets populated and always has zero objects. What am I doing wrong. And, yes str has data. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: noobie mem management problem
Peter - Thank you that does clear up a lot. And now it works beautifully on my iphone in simulator mode. However, when I ad-hoc it to my phone... it doesn't work. I get this in my log: 11 Foundation 0x306cab10 _NSArrayRaiseInsertNilException + 48 12 Foundation 0x3066f8ec -[NSCFArray insertObject:atIndex:] + 152 13 Foundation 0x3066f844 -[NSCFArray addObject:] + 30 14 WhatsFresh 0xc796 -[Sqlite executeQuery:] (Sqlite.m:122) 15 WhatsFresh 0x4946 -[WhatsFreshAppDelegate statesForItemAndMonthAndFresh:month:fresh:] So is there something "different" that I have to do for the iphone itself? Thanks James On Feb 26, 2009, at 8:10 AM, Peter N Lewis wrote: At 6:50 -0600 26/2/09, James Cicenia wrote: In .h : NSMutableArray *currentStates; @property (nonatomic, copy) NSMutableArray *currentStates; Now in my appdelegate I have: @synthesize currentStates; then in a method: while (sqlite3_step(statement) == SQLITE_ROW) { char *str = (char *)sqlite3_column_text(statement, 0); [self.currentStates addObject:(str) ? [NSString stringWithUTF8String:str] : @""]; } However currentStates never gets populated and always has zero objects. What am I doing wrong. And, yes str has data. Where is currentStates actually allocated? Initially all ivars are set to nil (or 0 or whatever). So unless you've set it somewhere, self.currentStates will return nil, and in Objective C, you can send a message to nil and it is simply a NoOp (ie, you wont get any error or exception). currentStates needs to be allocated. The next issue (and this is almost certainly where your problem is) is that your @property is set to copy, so: [self.currentStates addObject:@"hello"]; is equivalent: [[self currentStates] addObject:@"hello"]; And [self currentStates] returns a copy of the NSMutableArray. And so you create a copy, then you add the string, then it is autoreleased. So the issue is that the property specified "copy", which I don't think actually makes sense for a NSMutableArray (besides [NSMutableArray copy] actually returns an immutable NSArray (is there any way to specify mutableCopy in an @property?)). So you probably need to change the @property from copy to retain. Alternatively, use the property without the setter/getter reference, ie: [currentStates addObject:@"hello"]; I hope that clears up more than it confuses, Peter. @interface TestObject : NSObject { NSMutableArray *currentStates; } @property (nonatomic, retain) NSMutableArray *currentStates; @end @implementation TestObject @synthesize currentStates; - (id) init { self = [super init]; if (self != nil) { self.currentStates = [NSMutableArray array]; } return self; } - (void) Test; { [self.currentStates addObject:[NSString stringWithUTF8String:"Hello"]]; } - (void) dealloc { [currentStates release]; [super dealloc]; } @end int main(int argc, char *argv[]) { NSLog( @"main" ); NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; TestObject* obj = [[TestObject alloc] init]; [obj Test]; NSLog( @"%@", obj.currentStates ); [pool release]; //return NSApplicationMain(argc, (const char **) argv); } -- Run macros from your iPhone with Keyboard Maestro Control! or take a break with Aragom Space War for your iPhone Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get killed! <http://www.stairways.com/> <http://download.stairways.com/> ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why doesn't this work on my device?
Here is the code. It works on the simulator: -(NSMutableArray *)statesWithinMiles:(NSString *)miles{ NSMutableArray *states = [[NSMutableArray alloc]init]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"]; if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { sqlite3_create_function(database, "distance", 4, SQLITE_UTF8, NULL, &distanceFunc, NULL, NULL); NSString *tmp = @"SELECT DISTINCT state_abbr as state FROM geoinfo WHERE distance(Latitude, Longitude, "; tmp = [tmp stringByAppendingString:[self currentLatitude]]; tmp = [tmp stringByAppendingString:@","]; tmp = [tmp stringByAppendingString:[self currentLongitude]]; tmp = [tmp stringByAppendingString:@") < "]; tmp = [tmp stringByAppendingString:miles]; tmp = [tmp stringByAppendingString:@" and state_abbr NOT NULL ;"]; const char *sql = [tmp cStringUsingEncoding:NSUTF8StringEncoding]; sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { char *str = (char *)sqlite3_column_text(statement, 0); [states addObject:(str) ? [NSString stringWithUTF8String:str] : @""]; } } } return states; } Why doesn't this work on the device? Help this is causing me hours of grief with errors like these. Thanks from a noobie who is almost there. James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
First off thank you for answering Well unfortunately,,, this problem is more than in this bit of code. Here is a snippet where the statesArray never gets filled. It works great in the simulator. I think I am missing some key retain or such.. statesArray is synthesized and properly setup in my .h file with: NSMutableArray *currentStates; @property (nonatomic, copy) NSMutableArray *statesArray; Now I have tried about four variations on this code and nothing seems to make a difference. Thanks James - (void)statesForItemAndMonthAndFresh:(NSString *)itemName month: (NSString *)month fresh:(Boolean)fresh{ Sqlite *sqlite = [[Sqlite alloc] init]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"]; if (![sqlite open:writableDBPath]) return ; if(fresh){ NSArray *results = [sqlite executeQuery:@"SELECT DISTINCT AvailableItem.state FROM AvailableItem, ProduceItem where AvailableItem.hotHouse = 'FALSE' AND AvailableItem.produceItemID = ProduceItem.id AND ProduceItem.name = ? and AvailableItem.month = ?;",itemName,month]; for (NSDictionary *dictionary2 in results) { [self.statesArray addObject:[dictionary2 objectForKey:@"state"]] ; } }else{ NSArray *results = [sqlite executeQuery:@"SELECT DISTINCT AvailableItem.state FROM AvailableItem, ProduceItem where AvailableItem.hotHouse = 'TRUE' AND AvailableItem.produceItemID = ProduceItem.id AND ProduceItem.name = ? and AvailableItem.month = ?;",itemName,month]; for (NSDictionary *dictionary2 in results) { [self.statesArray addObject:[dictionary2 objectForKey:@"state"]] ; } } [sqlite release]; } On Feb 26, 2009, at 4:14 PM, Jason Foreman wrote: On Thu, Feb 26, 2009 at 3:37 PM, James Cicenia wrote: Why doesn't this work on the device? Help this is causing me hours of grief with errors like these. What errors? You haven't shown any, just code. Define "doesn't work" and you'll get better help. if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { Use -fileSystemRepresentation, not -UTF8String. Are you sure the file exists where you think it does? tmp = [tmp stringByAppendingString:[self currentLatitude]]; tmp = [tmp stringByAppendingString:@","]; tmp = [tmp stringByAppendingString:[self currentLongitude]]; tmp = [tmp stringByAppendingString:@") < "]; tmp = [tmp stringByAppendingString:miles]; tmp = [tmp stringByAppendingString:@" and state_abbr NOT NULL ;"]; -stringByAppendingFormat might clean this up. Jason ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
I have used both retain and without: - (void)applicationDidFinishLaunching:(UIApplication *)application { statesArray = [[[NSMutableArray alloc] init]retain]; On Feb 26, 2009, at 4:56 PM, Bill Bumgarner wrote: On Feb 26, 2009, at 2:53 PM, James Cicenia wrote: @property (nonatomic, copy) NSMutableArray *statesArray; Where are you allocating statesArray? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
I understand. I read the docs on memory management. Thought I understood it, fixed my code, etc. Then I pushed it to the phone. Maybe I need to sleep on this. Though it would have been nice if the simulator really was a simulator. I was so close, so excited, etc. and then bam! It doesn't work on my phone. Thanks for at least reassuring me that one day I will grok this memory inside and out. A, java... James On Feb 26, 2009, at 5:02 PM, Bill Bumgarner wrote: On Feb 26, 2009, at 2:58 PM, James Cicenia wrote: I have used both retain and without: - (void)applicationDidFinishLaunching:(UIApplication *)application { statesArray = [[[NSMutableArray alloc] init]retain]; OK -- you need to step back and think this stuff through. In particular, the above is a double retain and that you tried it with and without indicates that you are taking wild stabs with a hope that something works. No worries and don't take it as an insult -- we all do this (you should have seen the adventure I had with some header files yesterday! "what if I just stick a semicolon HERE!" no... step back... take a breath... think it through..."). Assuming that the above is executed and statesArray isn't prematurely released (and set to nil or else you'd get a crash), then your bug lies elsewhere. You say it works in the simulator but not on the device? I'd suggest stepping through whatever is supposed to fill the array to make sure it is working as expected. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
hmmm... Well I am WebObjects guy, so, I know java pretty darn well and it is fast on the server. I love developing for the iphone. And I find objective-c to be really nice with this one major hole in my knowledge. Anyway, I do load something from a preferences file. So how do I debug that on the phone? James On Feb 26, 2009, at 5:25 PM, Bill Bumgarner wrote: On Feb 26, 2009, at 3:23 PM, James Cicenia wrote: I understand. I read the docs on memory management. Thought I understood it, fixed my code, etc. Then I pushed it to the phone. Maybe I need to sleep on this. Though it would have been nice if the simulator really was a simulator. I was so close, so excited, etc. and then bam! It doesn't work on my phone. Thanks for at least reassuring me that one day I will grok this memory inside and out. A, java... Heh -- having used Java on phones mmm... glacial. This doesn't sound like a memory problem. If it isn't crashing and it really is creating that mutable array, you have a problem somewhere else. Most likely, it is trying to load something from the filesystem and not finding it where you think it should be. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
OK - Let me bother you one time more. I have found, the offending code, based upon log files etc. currentStates = [[NSMutableArray alloc] init]; self.currentStates = [self statesWithinMiles:currentMiles]; currentStates is not holding up in the device. It is somehow or somewhere getting released. I have searched the project and I am not releasing it anywhere. But, come the device, it loses itself. And then downstream methods that use this array bomb out. ? James On Feb 26, 2009, at 5:32 PM, Bill Bumgarner wrote: On Feb 26, 2009, at 3:29 PM, James Cicenia wrote: hmmm... Well I am WebObjects guy, so, I know java pretty darn well and it is fast on the server. I love developing for the iphone. And I find objective-c to be really nice with this one major hole in my knowledge. Anyway, I do load something from a preferences file. So how do I debug that on the phone? How do you set up the registration defaults in the first place? If you are using NSUserDefaults, you should be using -registerDefaults:. Now, if you are talking about loading a file manually, do you: - check to see if the file exists (NSFileManager's fileExistsAtPath:)? - check to see if reading the file worked (dictionaryWithContentsOfFile: returned something)? - check to see if it contains what you expect? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
d'oh That is helping immensely. I have isolated it to the sqlite area. I can't believe I didn't know you could debug on the device itself.. THANKS! Though it works very bizarrely ... seems to step backwards sometimes?! Anyway, onto reading more about sqlite in the device itself. It doesn't seem to return any rows. Do I have to do something special to get the data filled database into the phone? It is in my resources group. James On Feb 26, 2009, at 9:15 PM, Michael Ash wrote: On Thu, Feb 26, 2009 at 6:29 PM, James Cicenia wrote: hmmm... Well I am WebObjects guy, so, I know java pretty darn well and it is fast on the server. I love developing for the iphone. And I find objective-c to be really nice with this one major hole in my knowledge. Anyway, I do load something from a preferences file. So how do I debug that on the phone? The Xcode debugger works as well on the phone as it does in the simulator. Which is to say that it is cantankerous, bizarre, difficult, error-prone, and unstable. But still an invaluable tool. Simply choose Run->Debug with your settings on "Device" and you'll be able to use the debugger on your device code, assuming the thing hasn't chosen to be broken at that moment. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
It is a new morning. Same problem. Here is my code: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"]; int cntv = 0; int cntf = 0; ProduceItem *item=nil; if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { // Get the primary key for all books. const char *sql = "SELECT type, subtype, name, id FROM ProduceItem ORDER BY name"; sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { It does get to the second If statement so it did find the database. But then evidently it is not SQLITE_OK on my device in regards to that last if. These so simple things always take the most time. 1000s of lines of code only to be stuck on this little database. Thanks for all the help so far as I have eliminated some bad practices and even cleaned up some memory leaks. Now to just get this to work on my device. Thanks James On Feb 26, 2009, at 11:34 PM, Bill Bumgarner wrote: On Feb 26, 2009, at 8:50 PM, James Cicenia wrote: That is helping immensely. I have isolated it to the sqlite area. I can't believe I didn't know you could debug on the device itself.. THANKS! Though it works very bizarrely ... seems to step backwards sometimes?! That'll most likely be because of the optimizer. If the compiler determines that statement B after statement A has no impact on A and would be faster to execute before A, it'll emit code that does exactly that [very simplistic example]. Anyway, onto reading more about sqlite in the device itself. It doesn't seem to return any rows. Do I have to do something special to get the data filled database into the phone? It is in my resources group. Did you make sure that the database is on the device where you expect it and really there (say, again, via NSFileManager's fileExistsAtPath:)? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
Thanks for your patience. I did in fact use portions of sqlite books and have the following code: // Creates a writable copy of the bundled default database in the application Documents directory. - (void)createEditableCopyOfDatabaseIfNeeded { // First, test for existence. BOOL success; NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"]; success = [fileManager fileExistsAtPath:writableDBPath]; if (success) return; // The writable database does not exist, so copy the default to the appropriate location. NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"whatsfresh.sql"]; success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error]; if (!success) { NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]); } } when I debug it, it achieves success so it does exist. Someone wrote: if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) Don't use UTF8String to get a C string for a file system path, you should use -fileSystemRepresentation. I don't even know what that is? Thanks James On Feb 27, 2009, at 10:35 AM, Bill Bumgarner wr, ote: On Feb 27, 2009, at 7:56 AM, James Cicenia wrote: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"whatsfresh.sql"]; int cntv = 0; int cntf = 0; ProduceItem *item=nil; if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { const char *sql = "SELECT type, subtype, name, id FROM ProduceItem ORDER BY name"; sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { It does get to the second If statement so it did find the database. But then evidently it is not SQLITE_OK on my device in regards to that last if. Have you checked to see if the file at path actually exists? The documentation for sqlite3_open() indicates that it will quite happily create a band new empty database if one doesn't exist at the path. Have a look at the SQLite Book List example (http://developer.apple.com/iphone/library/samplecode/SQLiteBooks/listing4.html ) as it demonstrates testing for the database file and then copying it into the writable location, as necessary. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
ARrrgh... The database exists but it contains nothing?! I double checked it in my trusty firefox sqlite extension, and everything is there. Is there some magic "touch" I need to do to get the tables properly into the device? I have cleaned my project, restarted xcode, rebuilt, etc. thanks James On Feb 27, 2009, at 10:55 AM, Bill Bumgarner wrote: On Feb 27, 2009, at 8:44 AM, James Cicenia wrote: Don't use UTF8String to get a C string for a file system path, you should use -fileSystemRepresentation. I don't even know what that is? It is documented-- google, Xcode's documentation window, or developer.apple.com will quickly fulfill your curiosity: http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#/ /apple_ref/occ/instm/NSString/fileSystemRepresentation (Sorry to be harsh -- but "RTFM" is something we all fail to do far too often and I'm singly you out to remind me to do the same :) if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { const char *sql = "SELECT type, subtype, name, id FROM ProduceItem ORDER BY name"; sqlite3_stmt *statement; if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) { You can grab more error information by doing something like: NSLog(@"Oops %s", sqlite3_errmsg(database)); If it says that the table doesn't exist then the database isn't being correctly installed (or correctly initialized). b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why doesn't this work on my device?
YES YES YES Maybe with all my... yes, I admit, start throwing stuff, deleting, recoding, I must have done that. Then I just "assumed" that it would it push a fresh copy over. Wow, that was a frustrating bug. Again,,, thank you, thank you, thank you. I owe you a beer, or whatever. Appstore here I come :-) On Feb 27, 2009, at 11:23 AM, Bill Bumgarner wrote: On Feb 27, 2009, at 9:07 AM, James Cicenia wrote: ARrrgh... The database exists but it contains nothing?! I double checked it in my trusty firefox sqlite extension, and everything is there. Is there some magic "touch" I need to do to get the tables properly into the device? I have cleaned my project, restarted xcode, rebuilt, etc. Did you run the app w/o the copy code at some point, causing the database to come into existence, and then haven't reset it? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Where or when do I release this object from this action.
Here is my code: - (void)monthFruitAction:(id)sender{ MonthPickerViewController *mpvc = [[MonthPickerViewController alloc]initWithNibName:@"MonthPicker" bundle:nil]; [mpvc setMyParentController:self]; mpvc.view.frame =CGRectMake(19,66,260,258); [fruitTypeView addSubview:mpvc.view]; } How should I release mpvc ? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where or when do I release this object from this action.
Here is the scenario - If I put [mpvc release] at the end, my popup won't show, which perplexes me. This action pushes a view onto the existing view. It is a small view with a bunch of buttons. So, I am confused on where or when it should be released. thanks - j- On Feb 27, 2009, at 3:50 PM, I. Savant wrote: On Fri, Feb 27, 2009 at 4:43 PM, James Cicenia wrote: Here is my code: - (void)monthFruitAction:(id)sender{ MonthPickerViewController *mpvc = [[MonthPickerViewController alloc]initWithNibName:@"MonthPicker"bundle:nil]; [mpvc setMyParentController:self]; mpvc.view.frame =CGRectMake(19,66,260,258); [fruitTypeView addSubview:mpvc.view]; } How should I release mpvc ? [mpvc release]; ??? Seriously, you'll need to be more specific about what you're asking. Do you mean you want to know *when* to release it? It's difficult to say without more detail about what your intentions are in your specific project. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where or when do I release this object from this action.
OK - The question is where do I release that object. If I put the release at the end of the method, nothing will pop into my view. If I don't release it, it works fine, but then I am worried about a leak. - (void)monthFruitAction:(id)sender{ MonthPickerViewController *mpvc = [[MonthPickerViewController alloc]initWithNibName:@"MonthPicker" bundle:nil]; << If I autorelase, this method will NOT show my view. [mpvc setMyParentController:self]; mpvc.view.frame =CGRectMake(19,66,260,258); [fruitTypeView addSubview:mpvc.view]; [mpvc release] << If I put this in, this method will NOT show my view. } So, I am wondering how I am to release this object. Thanks James On Feb 27, 2009, at 4:23 PM, Shawn Erickson wrote: On Fri, Feb 27, 2009 at 1:57 PM, James Cicenia wrote: Here is the scenario - If I put [mpvc release] at the end, my popup won't show, which perplexes me. At the end of what? Please give us a much more complete picture when you ask a question ... otherwise you are wasting yours and our time. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where or when do I release this object from this action.
Thanks That makes a lot of sense. James On Feb 27, 2009, at 5:25 PM, Sherm Pendley wrote: On Fri, Feb 27, 2009 at 5:42 PM, James Cicenia wrote: OK - The question is where do I release that object. If I put the release at the end of the method, nothing will pop into my view. If I don't release it, it works fine, but then I am worried about a leak. - (void)monthFruitAction:(id)sender{ MonthPickerViewController *mpvc = [[MonthPickerViewController alloc]initWithNibName:@"MonthPicker"bundle:nil]; << If I autorelase, this method will NOT show my view. [mpvc setMyParentController:self]; mpvc.view.frame =CGRectMake(19,66,260,258); [fruitTypeView addSubview:mpvc.view]; [mpvc release] << If I put this in, this method will NOT show my view. } So, I am wondering how I am to release this object. The question is, will you be done with it within the scope of this method? As a general rule, if you want to keep something around for longer than that, you need to make it an instance variable instead of a local variable. That way you'll be able to release it later. Since you're using dot-syntax, I assume you're using Objective-C 2.0. So, declare a retained property, like this: @property (retain) MonthPickerViewController *mpvc; And, of course, synthesize the accessors for it: @synthesize mpvc; Now, since you've specified retain behavior for the accessors, you'll need to autorelease the controller when you create it - otherwise you'd over-retain it. Since it's no longer a local variable, you'll need to use self.mpvc to access it: - (void)monthFruitAction:(id)sender { self.mpvc = [[[MonthPickerViewController alloc] initWithNibName:@"MonthPicker" bundle:nil] autorelease]; [self.mpvc setMyParentController:self]; self.mpvc.view.frame = CGRectMake(19,66,260,258); [fruitTypeView addSubview:self.mpvc.view]; } Now, when all is said and done, and you're finished with mpvc, just assign nil to it. With retain symantics for the synthesized accessor methods, doing so should release the old value: self.mpvc = nil; sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Optimizing, uiview caching, and clearing that cached view.
Hello - I just noticed that my app's view controller is not clearing out the view and so if i make a selection somewhere else, the new data is being populated over the old data and showing up in the view. This could actually be good because it could increase the performance of my app... However, it seems that my app always will run the viewwillappear method. So I have two questions now. How do I skip over my populating code in ViewWillAppear to increase the response time of my app? How do I then clear the view when a new selection is made that should change the view? Thank you James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Do I need to relase @"string" ??
hello Here is my code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath { WhatsFreshAppDelegate *appDelegate = (WhatsFreshAppDelegate *) [[UIApplication sharedApplication] delegate]; if(indexPath.row == 0){ [appDelegate setCurrentMiles:@"200"]; }else if(indexPath.row==1){ [appDelegate setCurrentMiles:@"500"]; }else if(indexPath.row==2){ [appDelegate setCurrentMiles:@"1000"]; }else if(indexPath.row==3){ [appDelegate setCurrentMiles:@"1500"]; }else if(indexPath.row==4){ [appDelegate setCurrentMiles:@"2000"]; }else if(indexPath.row==5){ [appDelegate setCurrentMiles:@"2500"]; }else if(indexPath.row==6){ [appDelegate setCurrentMiles:@"5000"]; }else if(indexPath.row==7){ [appDelegate setCurrentMiles:@"1"]; } [appDelegate setupStateDisplay:[appDelegate currentLatitude] longString:[appDelegate currentLongitude] milesString:[appDelegate currentMiles]]; [appDelegate refreshLocation:TRUE]; [(MyLocationViewController *)myParentController resetMiles]; } DO I HAVE TO WORRY ABOUT RELEASING currentMiles somewhere? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
I can't find the leak on this simple table view.
Hello - I have a table view that I popup. However it is giving me leaks and something about NSIndexPath is shown in leaks in instruments. It is leaking upon showing the table view. I have a mainview --> PopupView --> PopupView2 the PopupView2 is the one giving me the leak upon display. here is the code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"MilesCell_ID"; MilesCell *cell =(MilesCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell =(MilesCell *) [[[MilesCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } if(indexPath.row == 0){ [[cell numberImageView]setImage:image200]; }else if(indexPath.row==1){ [[cell numberImageView]setImage:image500]; }else if(indexPath.row==2){ [[cell numberImageView]setImage:image1000]; }else if(indexPath.row==3){ [[cell numberImageView]setImage:image1500]; }else if(indexPath.row==4){ [[cell numberImageView]setImage:image2000]; }else if(indexPath.row==5){ [[cell numberImageView]setImage:image2500]; }else if(indexPath.row==6){ [[cell numberImageView]setImage:image5000]; }else if(indexPath.row==7){ [[cell numberImageView]setImage:image1000]; } return cell; } The Item cell inherits from another cell and doesn't override anything. And that superclass cell doesn't leak. So how do I track this kind of leak down? Thanks James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: I can't find the leak on this simple table view.
No ,,, facetious works for me thanks.. just trying hard to make my little app more like a vault and less like a bank... not to be facetious. ;-) On Mar 2, 2009, at 8:10 PM, mmalc Crawford wrote: On Mar 2, 2009, at 5:52 PM, James Cicenia wrote: So how do I track this kind of leak down? To be somewhat facetious on this occasion: <http://www.google.com/search?client=safari&rls=en-us&q=nsindexpath+leak&ie=UTF-8&oe=UTF-8 > It's a known issue. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
All my leaks are gone... but now a memory warning?!
Hello - I have dutifully tracked down every leak, except for that noted nsindex issue that is a red-herring. Otherwise I get none now with my instruments. However, when I debug on the device one of my screens is getting memory warning and after a few clicks freezes up my phone. I have dutifully followed: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html and put in my setview and deallocs of my outlets. However, this doesn't seem to cure the problem. What do I do next? I am very confused about this. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: All my leaks are gone... but now a memory warning?!
hmmm,,, how do I get that? I just put a nslog in there to see if in fact it was memory. james On Mar 3, 2009, at 9:20 PM, Roland King wrote: what is the memory warning? James Cicenia wrote: Hello - I have dutifully tracked down every leak, except for that noted nsindex issue that is a red-herring. Otherwise I get none now with my instruments. However, when I debug on the device one of my screens is getting memory warning and after a few clicks freezes up my phone. I have dutifully followed: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html and put in my setview and deallocs of my outlets. However, this doesn't seem to cure the problem. What do I do next? I am very confused about this. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: All my leaks are gone... but now a memory warning?!
Ok - How do I get more information? Or what kind of information do you need? The memory issue is very opaque to me. It just happens. Is there anyway to get more info? Thanks James Cicenia On Mar 3, 2009, at 9:52 PM, David Duncan wrote: On Mar 3, 2009, at 7:16 PM, James Cicenia wrote: I have dutifully tracked down every leak, except for that noted nsindex issue that is a red-herring. Otherwise I get none now with my instruments. However, when I debug on the device one of my screens is getting memory warning and after a few clicks freezes up my phone. Memory warnings are a fact of life on iPhone OS, but without more information on why your freezing, it will be nearly impossible to actually help. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: All my leaks are gone... but now a memory warning?!
I see that on that one screen it does chew up memory after I select and process. My other three screens all behave very nicely. So, maybe it is the way I have architected this screen: When I load the view it seems ok. Then I popup a little view for the user to select a state: - (void)stateAction:(id)sender{ self.spvc = [[StatePickViewController alloc]initWithNibName:@"StatePicker" bundle:nil]; spvc.view.frame = CGRectMake(28,65,260,258); [spvc setMyParentController:self]; [spvc setDialogView:fruitTypeView]; [spvc viewWillAppear:TRUE]; [fruitTypeView addSubview:spvc.view]; } Then when they click the state from that view: -(void)resetState{ [spvc.view removeFromSuperview]; [spvc release]; [self viewWillAppear:TRUE];<<<<<= IS THIS THE CULPRIT? } Do I need to release something? Thanks James On Mar 3, 2009, at 10:12 PM, Roland King wrote: well how much memory is your app using? One of the performance tools should be able to help you not just get rid of leaks, but tell you how big your memory footprint is. Just because you're not leaking objects doesn't mean you're not pooling them up somewhere on an autorelease pool. If you use instruments or object alloc etc do you see a rapidly climbing memory usage or huge numbers of allocated but not yet freed objects? Are you making objects which uses masses of memory? The performance tools should be able to run against the simulator and show how your memory footprint is changing. James Cicenia wrote: Ok - How do I get more information? Or what kind of information do you need? The memory issue is very opaque to me. It just happens. Is there anyway to get more info? Thanks James Cicenia On Mar 3, 2009, at 9:52 PM, David Duncan wrote: On Mar 3, 2009, at 7:16 PM, James Cicenia wrote: I have dutifully tracked down every leak, except for that noted nsindex issue that is a red-herring. Otherwise I get none now with my instruments. However, when I debug on the device one of my screens is getting memory warning and after a few clicks freezes up my phone. Memory warnings are a fact of life on iPhone OS, but without more information on why your freezing, it will be nearly impossible to actually help. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SOLVED Re: All my leaks are gone... but now a memory warning?!
I used this after opening sqlite: // Modify cache size so we don't overload memory. 50 * 1.5kb if (sqlite3_exec(database, "PRAGMA CACHE_SIZE=50;", NULL, NULL, NULL) ! = SQLITE_OK) { NSAssert1(0, @"Error: failed to set cache size with message '%s'.", sqlite3_errmsg(database)); } Thanks James ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
View Caching Issues and Questions
Hello - I am a bit confused on when or why a view is cached and what is the best possible way to clear it. First: I have a UITabBarController. The views that this brings up are cached. This is actually great as I can test to see if something is changed and if so, do nothing and it brings up my view quick. So far so good. However, when I issue a viewWillAppear it seems that instead of "re- creating" my view it is actually overlaying my new image views on it without the old ones going away. I have done something like: NSEnumerator *itemEnum = [ [veggieScrollView subviews] objectEnumerator]; UIView *tView; while (tView = [itemEnum nextObject]) { if([tView tag]==101)[tView removeFromSuperview]; } And it clears those images but that seems rather poor to me and that their must be a better and cleaner way. Now I also have views that I popup from those parent views above and they DON'T cache the view so they have to be reconstituted in their viewWillAppear each time. This is bad because those popups have content that never changes once the program loads. So in their case, I want them to be cached. Any help would be greatly appreciated. James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSString leak or RedHerring again?
Hello - I do this a lot but only this give me leaks: while (sqlite3_step(statement) == SQLITE_ROW) { AvailableItem *newItem = [[AvailableItem alloc]init]; [newItem setName: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]]; [newItem setType: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]; [newItem setSubtype: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)]]; [items addObject:newItem]; [newItem release]; } My instruments tells me it is leaking NSString. AvailableItem is a bare bones class with just synthesize and nothing else. Why is it leaking? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString leak or RedHerring again?
I had thought that @synthesize does that autmatically. I guess not. On Mar 5, 2009, at 1:18 PM, Bill Bumgarner wrote: On Mar 5, 2009, at 10:54 AM, James Cicenia wrote: AvailableItem is a bare bones class with just synthesize and nothing else. Why is it leaking? You need to release the strings in AvaiableItem's -dealloc method. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString leak or RedHerring again?
OK That worked but now that I got you: Why is it complaining about the indicated array below: while (sqlite3_step(statement) == SQLITE_ROW) { //find subtype as key in the dict first if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)]]){ NSMutableArray *tmparray = [[NSMutableArray alloc]init]; <<<<<== = Says it leaks? [aDict setValue:tmparray forKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)]]; [tmparray release]; } subtypeArray = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 2)]]; [subtypeArray addObject: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]]; [aDict setValue:subtypeArray forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 2)]]; } Thanks again, James Cicenia On Mar 5, 2009, at 1:18 PM, Bill Bumgarner wrote: On Mar 5, 2009, at 10:54 AM, James Cicenia wrote: AvailableItem is a bare bones class with just synthesize and nothing else. Why is it leaking? You need to release the strings in AvaiableItem's -dealloc method. b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why is my UIColor white actually gray?
Hello - I have a table view with dynamic subclassed cells : - (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier { if (self = [super initWithFrame:aRect reuseIdentifier:identifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; [self setImage:[[UIImage imageNamed:@"WF-MyLocBu- DistBack.png"]autorelease]]; UIImageView *imageView = [[UIImageView alloc] initWithImage: produceImage]; [self.contentView addSubview:imageView]; [imageView release]; CGRect frame = CGRectMake(60, 0, 140, 60); produceName = [[UILabel alloc] initWithFrame:frame]; produceName.backgroundColor = [UIColor clearColor]; produceName.opaque = YES; produceName.textAlignment = UITextAlignmentLeft; produceName.textColor = [UIColor whiteColor]; produceName.font = [UIFont boldSystemFontOfSize:16]; [self.contentView addSubview:produceName]; [produceName release]; } return self; } BUT The font is hard to read and actually gray and not white? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why is my UIColor white actually gray?
Hmm, What do you mean? Thanks James On Mar 6, 2009, at 3:00 PM, Alex Kac wrote: Could it be anti-aliased? On Mar 6, 2009, at 2:57 PM, James Cicenia wrote: Hello - I have a table view with dynamic subclassed cells : - (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier { if (self = [super initWithFrame:aRect reuseIdentifier:identifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; [self setImage:[[UIImage imageNamed:@"WF-MyLocBu- DistBack.png"]autorelease]]; UIImageView *imageView = [[UIImageView alloc] initWithImage: produceImage]; [self.contentView addSubview:imageView]; [imageView release]; CGRect frame = CGRectMake(60, 0, 140, 60); produceName = [[UILabel alloc] initWithFrame:frame]; produceName.backgroundColor = [UIColor clearColor]; produceName.opaque = YES; produceName.textAlignment = UITextAlignmentLeft; produceName.textColor = [UIColor whiteColor]; produceName.font = [UIFont boldSystemFontOfSize:16]; [self.contentView addSubview:produceName]; [produceName release]; } return self; } BUT The font is hard to read and actually gray and not white? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. "The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true." -- James Clabell ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why is my UIColor white actually gray?
I don't see any property for antialiasing on or off. How do I turn it off to see? On Mar 6, 2009, at 3:21 PM, Alex Kac wrote: Well if the text is anti-aliased (which it is by default in a UILabel), then the center of the text would be white, but the edges are gray to help make it smooth. If the font is small enough, it can look gray and not pure white. On Mar 6, 2009, at 3:17 PM, James Cicenia wrote: Hmm, What do you mean? Thanks James On Mar 6, 2009, at 3:00 PM, Alex Kac wrote: Could it be anti-aliased? On Mar 6, 2009, at 2:57 PM, James Cicenia wrote: Hello - I have a table view with dynamic subclassed cells : - (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier { if (self = [super initWithFrame:aRect reuseIdentifier:identifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; [self setImage:[[UIImage imageNamed:@"WF-MyLocBu- DistBack.png"]autorelease]]; UIImageView *imageView = [[UIImageView alloc] initWithImage: produceImage]; [self.contentView addSubview:imageView]; [imageView release]; CGRect frame = CGRectMake(60, 0, 140, 60); produceName = [[UILabel alloc] initWithFrame:frame]; produceName.backgroundColor = [UIColor clearColor]; produceName.opaque = YES; produceName.textAlignment = UITextAlignmentLeft; produceName.textColor = [UIColor whiteColor]; produceName.font = [UIFont boldSystemFontOfSize:16]; [self.contentView addSubview:produceName]; [produceName release]; } return self; } BUT The font is hard to read and actually gray and not white? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net This email sent to a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. "The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true." -- James Clabell Alex Kac - President and Founder Web Information Solutions, Inc. "I am not young enough to know everything." --Oscar Wilde ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Need to use Quartz... I think?
Hello - I am painting my iPhone scrollable view which is nested in a parent view. I had originally been looping through and creating about a 1000 UIImageViews. This worked fine and dandy on the simulator but in real life, I think it is killing my little iPhone App. So will just drawing the images with Quartz be that much better? Well I figured I would try. But I am now confused on how I am supposed to make it work. In the quartz demo they have this: -(void)drawView:(QuartzView*)view inContext:(CGContextRef)context bounds:(CGRect)bounds But my scrollable view is created programatically. So what do I do in that case? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Need to use Quartz... I think?
I am creating a visual indicator. There can be approximately up to 400 rows. Each row can have up to 24 little images. While in my instruments it never seems to get above 7MB on my device when a person selects enough parameters to actually display the rows it will eventually show up... say after about 8 secs. Then my app becomes unstable. Otherwise, if the parameter set is such that only about 40 rows show up, it works great non-stop throughout the app. I do want them to be able to scroll this list. Thank you for your time James On Mar 7, 2009, at 12:14 PM, David Duncan wrote: On Mar 7, 2009, at 10:00 AM, James Cicenia wrote: I am painting my iPhone scrollable view which is nested in a parent view. I had originally been looping through and creating about a 1000 UIImageViews. This worked fine and dandy on the simulator but in real life, I think it is killing my little iPhone App. So will just drawing the images with Quartz be that much better? Well I figured I would try. But I am now confused on how I am supposed to make it work. But my scrollable view is created programatically. So what do I do in that case? Quartz Demo does a little work to avoid creating a new view class for each demonstration (which may or may not be all that advantageous in hindsight). Either way, it is probably not really what you want in this case. What are you trying to do? If your trying to work with 1000 images, you almost certainly will not be able to work with them all in memory at once (and unless they are really tiny they won't all fit on screen at once, so having them all in memory at once is certainly a disadvantage). -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Need to use Quartz... I think?
Unfortunately they are not sequential. They are a graphical calendar with two images per month. They can exist, they can be yellow or they can be green. So, unfortunately, I can't do that. :-( On Mar 7, 2009, at 12:28 PM, David Duncan wrote: On Mar 7, 2009, at 10:22 AM, James Cicenia wrote: I am creating a visual indicator. There can be approximately up to 400 rows. Each row can have up to 24 little images. I imagine those images are pretty small if you can fit 24 of them across the screen... If the images are always displayed in the same order, then the simplest method might be something like this: Create a single image with all of your little images side by side in the correct order Create a UITableView For each UITableViewCell, embed a single opaque UIImageView. Assign the indicator UIImage as the content of that UIImageView Size the UIImageView to expose the number of indicators you desire and set its contentMode to UIViewContentModeLeft. If the indicators can appear in any order, you probably would still want to do this in a UITableView, but you probably have more work. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why don't only these images don't show on the device?
Hello - All my images show except for these: UIImageView *imageView = [[UIImageView alloc]initWithFrame: CGRectMake(30+(horizontalCount*92),15+currentYOffset,30,30)]; [imageView setImage: [UIImage imageNamed:[pName stringByAppendingString:@".i.png"]]]; [imageView setTag:100]; [scrollView addSubview:imageView]; However they do show on the simulator. Is there something obvious I am missing here? James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why don't only these images don't show on the device?
OK - It seems as though my builds aren't bringing over all my images. How can I force the build to include all these images? Thanks James On Mar 8, 2009, at 6:55 PM, James Cicenia wrote: Hello - All my images show except for these: UIImageView *imageView = [[UIImageView alloc]initWithFrame: CGRectMake(30+(horizontalCount*92),15+currentYOffset,30,30)]; [imageView setImage: [UIImage imageNamed:[pName stringByAppendingString:@".i.png"]]]; [imageView setTag:100]; [scrollView addSubview:imageView]; However they do show on the simulator. Is there something obvious I am missing here? James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why don't only these images don't show on the device?
Anyone? I have cleaned build this three times but not all the images are being moved over? Thank James Cicenia On Mar 8, 2009, at 8:43 PM, James Cicenia wrote: OK - It seems as though my builds aren't bringing over all my images. How can I force the build to include all these images? Thanks James On Mar 8, 2009, at 6:55 PM, James Cicenia wrote: Hello - All my images show except for these: UIImageView *imageView = [[UIImageView alloc]initWithFrame: CGRectMake(30+(horizontalCount*92),15+currentYOffset,30,30)]; [imageView setImage: [UIImage imageNamed:[pName stringByAppendingString:@".i.png"]]]; [imageView setTag:100]; [scrollView addSubview:imageView]; However they do show on the simulator. Is there something obvious I am missing here? James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How do I debug iPhone restarts?
Hello - While testing on my phone, the iPhone just quits my app and doesn't write a crash log or such. How does one debug this? Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Is UITableView more memory efficient than UIScrollView?
I am trying to get my one screen to work and I feel I am having a memory issue that just causes my application to reboot. Even though UITableView subclasses UIScrollView I was wondering if it pages memory or such and would be better for my app. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is UITableView more memory efficient than UIScrollView?
I have a listing of approximately 100 lines. Within each line I create a visual calendar that has up 24 images. These images are tiny. However, I have proved to myself that it is a memory issue and calling didRecieveMemory warning. This view has two tabs on top which allows you to switch between views. They are just a category for each with the same visual setup. When I switch the view, it displays, and then poof the app quits. I just can't seem to figure out what to do in that memory that will alleviate this problem. I have tried this: [veggieImageView release], veggieImageView = nil; [veggieTypeView release], veggieTypeView = nil; [veggieScrollView release], veggieScrollView = nil; but it just clears the view and then the same poof the app quits. I have aggressively tested everything else on this app and I am down to this one unstable area. Thank you, James Cicenia On Mar 9, 2009, at 6:43 PM, Mike Abdullah wrote: Well it rather depends what you ask UIScrollView to do for you… The most important thing is to recycle or dispose of views that are no longer visible to the user. Care to explain more what your code is actually doing? Mike. On 9 Mar 2009, at 22:27, James Cicenia wrote: I am trying to get my one screen to work and I feel I am having a memory issue that just causes my application to reboot. Even though UITableView subclasses UIScrollView I was wondering if it pages memory or such and would be better for my app. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Why does releasing this array cause a crash?
Hello I am confused on this one: In my method I have a local array: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [arraySubType addObject: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)]] [aDict setValue:arraySubType forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; } Shouldn't I now release arraySubType ?? If I do, later on I get a crash, if I don't I get no crash. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why does releasing this array cause a crash?
Ah... Thank you. I understand now. James On Mar 10, 2009, at 5:41 PM, Randall Meadows wrote: On Mar 10, 2009, at 4:35 PM, James Cicenia wrote: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; OK, this array, you *should* release, yes. Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; You have now just overwritten the previous value of arraySubType, thus leaking it. You now have a handle to a completely different object, which is autoreleased. This is why when you do release it, you crash later. If you do not use arraySubType between the alloc/init above and this line, then you do not need to alloc/init it, just declare it only. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
What is using up so much memory here?
Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@"wf-map-gray-" stringByAppendingString:thisState ]stringByAppendingString:@"_glow.png"]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Thanks James Ciceni ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@"wf-map-gray-" stringByAppendingString:thisState ]stringByAppendingString:@"_glow.png"]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
I am just overlaying colored state images over a map of the US. I don't need performance here, just memory efficiency. I will try imageWithContetsOfFile. Thanks James On Mar 10, 2009, at 6:45 PM, David Duncan wrote: On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. All depends on what you are trying to accomplish. Typically you avoid loading anything you don't need and release anything when your done with it. And you may want to switch to imageWithContentsOfFile: until you can prove that the caching behavior of imageNamed: is providing you with a performance improvement. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Well... easier said then done. How would one place irregular shapes of the state over the map itself? Any combination of states with a color needs to appear. I was just overlaying the same square with just one state in the square all lined up. James On Mar 10, 2009, at 6:51 PM, Dave Camp wrote: Well, since you obviously can't have all of those images on screen at the same time at full size, you should either just load what you need or resize them to a more appropriate size. Dave On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@"wf-map-gray-" stringByAppendingString:thisState ]stringByAppendingString:@"_glow.png"]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Ok - I figured out what I can do. I can make a database of the x/y coordinates after chopping down each state and then read the database info to place the states. Thanks for your hints and time. James On Mar 10, 2009, at 6:51 PM, Dave Camp wrote: Well, since you obviously can't have all of those images on screen at the same time at full size, you should either just load what you need or resize them to a more appropriate size. Dave On Mar 10, 2009, at 4:41 PM, James Cicenia wrote: Interesting... I didn't know that, but then it begs the question what do the cool kids do? Should I be taking a different approach here? If so, any pointers or doc chapter would be great. Thank you James Cicenia On Mar 10, 2009, at 6:33 PM, David Duncan wrote: On Mar 10, 2009, at 4:26 PM, James Cicenia wrote: Ok - Here is the offending code that sucks up about 2MB: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; while(thisState = [statesEnum nextObject]){ UIImageView *singleStateView = [[[UIImageView alloc]initWithFrame:CGRectMake(2,0, 293, 184)]autorelease]; [singleStateView setImage: [UIImage imageNamed:[[@"wf-map-gray-" stringByAppendingString:thisState ]stringByAppendingString:@"_glow.png"]]]; [singleStateView setTag:100]; [fruitStateView addSubview:singleStateView]; } [pool release]; These are little pngs of the states. They are tiny 4KB images yet when this loop runs it winds up taking up an additional 2MB Compressed size does not matter. Your images (or at least your image views) are 293x184, which means that each view is going to consume 293x184x4 (bytes per pixel) = 210.6K. I presume your looking at the Memory Monitor tool, as the memory used by view backing stores is not reflected in the memory usage as reported by the ObjectAlloc tool, but assuming your PNGs are the same size as the view, that 210.6K number is far more indicative of memory usage than the compressed size. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dave%40thinbits.com This email sent to d...@thinbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What is using up so much memory here?
Yes, I realized I would need a different approach. I got too used to web gif/png and just doing overlays. I have already told my designer to give me just bounded states with a spreadsheet of what he chopped off from the top and left. This will then be inputted into the spreadsheet then into sqlite. It should work a lot better. Thanks again for your input. James Cicenia On Mar 10, 2009, at 7:28 PM, Graham Cox wrote: On 11/03/2009, at 11:00 AM, James Cicenia wrote: Well... easier said then done. How would one place irregular shapes of the state over the map itself? Any combination of states with a color needs to appear. Since you are in a much-more memory-constrained environment, you need to get smart. Naively loading everything isn't going to work, so you need to figure this out. You have a map of the USA, I guess, and you can see part of it on screen at any one time (presumably scrolling to show different parts, or zooming in and out to show more or less). You can treat it as a bunch of tiled shapes, each having a bounding box. The bboxes will overlap a little in many places, but that's OK. All you need to do is build a data structure that associates the bboxes with the relevant images and graphics, then determine which bboxes intersect the visible screen area. For those that don't, you don't need to do anything. For those that do, you need to load the graphic elements, scale them as appropriate for your zoom (if need be - zoom is usually taken care of using the view's scale transform, but you may want to avoid caching a full-scale image if your zoom suggests you don't need it) and draw them. When you've done that, you can discard them again, or cache them for later. That's the basic M.O. If dynamically loading these images like this is too slow, you can then consider a way to cache what you loaded in such a way that when you become memory constrained, you can examine the cache and discard parts of it that you can't see right now, again by testing which bboxes intersect the screen. The same technique will work for zooming, because all you're doing is making the screen area that intersects your data smaller and bigger. If you cached a low-resolution graphic for a zoomed-out view, you can scale it while zooming is in progress to avoid an expensive re-load, then, if needed, reload a higher-res version at the end. Unfortunately you'll have to figure a scheme for doing all of this out for yourself, there isn't anything built-in because the need to do this is not all that generalisable. It's not that hard though. I would suggest though that using an entire subview for each overlaid image is going to hurt badly in terms of performance, scalability and ease of implementation. Instead just devise your own data structure that can hold objects having a bounding box (which sets the spatial location) and a reference to the image(s) it needs. Then when you draw, ask your data structure to draw all the cells that intersect the drawing area. For those that haven't loaded their images, they should now do so, then draw as usual. The overall data structure would have one object per state, but all it needs to maintain when not visible is the bbox. 50 rects is a far lower memory footprint than 50 full-sized images. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Help, I need a jedi memory master with time and patience to help me here.
Hello - I must be doing something conceptually wrong as this class will alway kill my app in the device without any console info. I am sure it is memory or retain related. In instruments my memory never goes above 5MB and then comes down a bit. In the device... it just quits after a few calls. If anyone has time, charity and patience and can help me spot what I am doing wrong, I would appreciate it. Just send me a response to me and I will send you the code. I have worked days on this. I have optimized my images. But something is wrong. One thing I did notice the retain count starts at 2 and ends at 2. I don't know if this is a hint or not. thank you kindly, James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Multiple Images into one UIView
Is it possible to add multiple images to one UIView. I am hoping that would help my memory issue. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Multiple Images into one UIView
My images are very small. I have approximately 100 lines with 24 small images per line. These are all one one scrollable view. I am using a UIImageView to position each one. Just trying to get efficient as possible here. On Mar 12, 2009, at 4:48 PM, Wyatt Webb wrote: Do you mean in some way other than embedding multiple UIImageViews or multiple CALayers? Unless your images are very small, I doubt the overhead of the UIView objects is what's causing a memory problem. Maybe I'm misunderstanding. Can you give us more detail about the current arrangement you have and what you are attempting to do? Wyatt On Mar 12, 2009, at 12:42 PM, James Cicenia wrote: Is it possible to add multiple images to one UIView. I am hoping that would help my memory issue. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/wwebb%40inspiration.com This email sent to ww...@inspiration.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Multiple Images into one UIView
I will look into that. Thank you On Mar 12, 2009, at 5:18 PM, Wyatt Webb wrote: Well, then maybe UIImageViews aren't the right choice. You could either use many CALayers or even a single large UIView(if you need user input events) or CALayer subclass where you render the images yourself. I presume there are only a small number of different images and you're using them over and over, right? If so, maybe it's better to subclass a view or layer such that you have your set of images loaded at init time and you simply draw them in the right place when you get the draw call. Then you don't have a large number of views or layers, you simply draw your images yourself when the time comes. Short of either drawing the images with primitives or pre-rendering larger chunks of the image, I'm not sure how to make it more efficient. Wyatt On Mar 12, 2009, at 2:53 PM, James Cicenia wrote: My images are very small. I have approximately 100 lines with 24 small images per line. These are all one one scrollable view. I am using a UIImageView to position each one. Just trying to get efficient as possible here. On Mar 12, 2009, at 4:48 PM, Wyatt Webb wrote: Do you mean in some way other than embedding multiple UIImageViews or multiple CALayers? Unless your images are very small, I doubt the overhead of the UIView objects is what's causing a memory problem. Maybe I'm misunderstanding. Can you give us more detail about the current arrangement you have and what you are attempting to do? Wyatt On Mar 12, 2009, at 12:42 PM, James Cicenia wrote: Is it possible to add multiple images to one UIView. I am hoping that would help my memory issue. Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/wwebb%40inspiration.com This email sent to ww...@inspiration.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Thanks!
Just wanted to say thanks to this list for being patient with me. My first "public" iPhone was accepted by Apple and is now on the store. What'sFresh is the name of the application. Again, thank you very much. I have found that whether it be cocoa or webobjects the people on these lists are incredible in their support, help and most importantly, patience. Thanks again, James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How do I find this compile error?
Undefined symbols: "_kCATransactionDisableActions", referenced from: _kCATransactionDisableActions$non_lazy_ptr in AudioViewController.o "_OBJC_CLASS_$_CALayer", referenced from: __objc_classrefs__d...@0 in AudioViewController.o "_OBJC_CLASS_$_CATransaction", referenced from: __objc_classrefs__d...@0 in AudioViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status Thanks James Cicenia ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I find this compile error?
Ah thanks! I won't forget that next time. Yes... core audio it was. thanks James On Apr 23, 2009, at 1:17 PM, Bill Bumgarner wrote: On Apr 23, 2009, at 11:09 AM, James Cicenia wrote: Undefined symbols: "_kCATransactionDisableActions", referenced from: _kCATransactionDisableActions$non_lazy_ptr in AudioViewController.o "_OBJC_CLASS_$_CALayer", referenced from: __objc_classrefs__d...@0 in AudioViewController.o "_OBJC_CLASS_$_CATransaction", referenced from: __objc_classrefs__d...@0 in AudioViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status That isn't a compiler error, that is a linker error! It means that you are using functionality in your application for which you haven't added the appropriate framework. Given the errors, I'm guessing you didn't include CoreAudio.framework in your project? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa-dev Digest, Vol 16, Issue 144
Well I think the point is to go SwiftUI. Go where the puck is going. Develop for iPad Pro and use SwiftUI to gain MacOS too. I got to believe enough of your business logic is now separated enough from the UI. Regards, James Cicenia Founder James John Group, LLC (+1) 773-398-4649 ja...@jjg.llc <mailto:ja...@jjg.llc> www.jjg.llc <http://www.jjg.llc/> 3133 McLin Rd, Saint Joseph. 49085 <https://maps.google.com/?q=3133+McLin+Rd%2C+Saint+Joseph.+49085> Makers of the The Perfect Crypto Currency Hodlr - INDX01 <https://apple.co/2XUm2Gg> > On Nov 14, 2019, at 1:41 PM, Turtle Creek Software via Cocoa-dev > wrote: > >>> Here’s your free advice and prognostications: > > https://developer.apple.com/videos/wwdc2019/ > https://developer.apple.com/develop/ > > Neither of those mention Cocoa at all, just SwiftUI. Only slight mention > of Objective-C in a couple of video descriptions about Clang/LLVM and > profiling. That does seem like a useful prognostication. Thanks for the > links! > > Casey McDermott > TurtleSoft.com > > On Thu, Nov 14, 2019 at 11:39 AM Gary L. Wade > wrote: > >> On Nov 14, 2019, at 8:29 AM, Turtle Creek Software via Cocoa-dev < >> cocoa-dev@lists.apple.com> wrote: >> >> I think this gets back to the transparency issue. If Apple were more open >> about the future, it would be easier to know which cliffs are real. >> >> >> Here’s your free advice and prognostications: >> >> https://developer.apple.com/videos/wwdc2019/ >> https://developer.apple.com/develop/ >> >> If you choose to ignore what is available to you, you have no one to blame >> but yourself. >> >> Oh, and by the way, if you use DeRez right, the output is very useful. In >> the terminal, type this command: >> >> man DeRez >> >> We’ve said this before, but now it’s definitely time to move on from this >> non-related topic. If you have Cocoa-related questions, please feel free >> to submit those. Otherwise, find another email list. >> -- >> Gary L. Wade >> http://www.garywade.com/ >> >> >> > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/james%40jimijon.com > > This email sent to ja...@jimijon.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa-dev Digest, Vol 16, Issue 144
Well about right in terms of timing if you start architecting / developing now. Meanwhile a iPad Pro is pretty sweet for the construction/architecture industry. > On Nov 14, 2019, at 2:30 PM, Pier Bover wrote: > > What if you want to support previous macOS versions older than Catalina? > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com