objective-c

My iPhone app ran fine in simulator but crashed on device (iPod touch 3.1.2) test, I got the following errors

I was running myapp on an iPod touch and I noticed it missed some libraries. Is that the reason? [Session started at 2010-03-19 15:57:04 +0800.] GNU gdb 6.3.50-20050815 (Apple version gdb-1128) (Fri Dec 18 10:08:53 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, an...

Objective-C Objects Having Each Other as Properties

Let's say we have two objects. Furthermore, let's assume that they really have no reason to exist without each other. So we aren't too worried about re-usability. Is there anything wrong with them "knowing about" each other? Meaning, can each one have the other as a property? Is it OK to do something like this in a mythical third c...

Retrieving Relationships from within two arrays of pointers

In a portion of a program I'm working on, I need to count all the times each person has worked on projects with each other person. Let's say we have "Employee" entities and "Session" entities. In each session, there are four project types, "A", "B", "C", & "D", each a many-to-many relationship to Employees. I'm making a loop to system...

How to efficiently get all instances from deeper level in Cocoa model?

In my Cocoa Mac app I have an instance A which contains an unordered set of instances B which in turn has an ordered set of instances C. An instance of C can only be in one instance B and B only in one A.   I would like to have an unordered set of all instances C available on instance A. I could enumerate over all instances B each time,...

Is there a Javadoc-like plugin for Xcode that automatically generates the doc template?

I'm aware of Doxygen to generate the documentation. What I'm looking for is quick way to insert documentation in Xcode similar to what Eclipse does when editing Java files. Let's say I have an objective-c method with a couple of arguments like this: -(NSInteger*) sumOf: (NSInteger*) one and:(NSInteger*) two {... In Eclipse, if you pl...

Audio looping in Objective-C/iPhone

So, I'm finishing up an iPhone App. I have the following code in place to play the file: while(![player isPlaying]) { totalSoundDuration = soundDuration + 0.5; //Gives a half second break between sounds sleep(totalSoundDuration); //Don't play next sound until the previous sound has finished [player play]; //Play sound NSLog(@" ...

UIImageView is clipping a pixel of the bottom of my UIImage...?

I'm not sure what might be causing this, but UIImageView occasionally clips off about a pixel or 2 from the bottom of some square/rectangular UIImages I'm using as subviews for UITableViewCells. These UIImageViews are well within the borders of the cell, so it shouldn't be due to cliptobounds. There seems to be no consistency or pattern ...

Getting memory leak in NSXMLParser.

Hi guys, Im getting the same memory leak as I mentioned the link below. http://stackoverflow.com/questions/1598928/nsxmlparser-leaking. Is it the real problem from the Apple developing side? And in that link I saw the answer from Lee Armstrong as: Apple have got back to me and this is a bug #6469143 Looks like they plan to fix for ...

Cannot hide a UIButton - Please help!

Hey again, I have the following code: visitSite.hidden = YES; For some reason, when I click a UIButton and call this piece of code, the visitSite button does not hide. The code is within this block: -(IBAction)welcomeButtonPressed:(id)sender { [UIButton beginAnimations:@"welcomeAnimation" context:NULL]; [UIButton setAnimationDu...

[Doing it Wrong] Auto Boxing of primitives

I can't seem to figure out how to get Objective-c to auto box my primitives. I assumed that i would be able to do the following float foo = 12.5f; NSNumber* bar; bar = foo; However i find that i have used to the more verbose method of float foo = 12.5f; NSNumber* bar; bar = [NSNumber numberWithFloat:foo]; Am i doing it wrong or ...

Does the dealloc in Appdelegate calls or not?

Hi guys, I the allocated arrays in the didFinishLaunching of my appdelegate.And I released those arrays in the dealloc of the appdelegate. My doubt here is does the dealloc of appdelegate calls?and does the arrays in the appdelegate releases or not? Anyone's help will be much appreciated. Thank you, Monish Kumar. ...

iPhone Options for reading item from XML?

I am accessing this data from a web server using NSURL, what I am trying to decide is should I read this as XML or should I just use NSScanner and rip out the [data] bit I need. I have looked around the web for examples of extracting fields from XML on the iPhone but it all seems a bit overkill for what I need. Can anyone make any sugges...

Why do parameter lists in certain cocoa methods end with a nil?

Why do parameters lists in some methods end with nil? I have noticed this particularly in the collection classes for example NSSet mySet = [NSSet setWithObjects:someData, aValue, aString, nil]; and NSArray NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil]; ...

Why can't I save changes to application settings with NSUserDefaults?

I am using the following code to save values from a settings view that takes values from a UITextField and stores them with NSUserDefaults. The code below even calls synchronize yet it is not saving the changes. What am I doing wrong here? - (IBAction)save { NSLog(@"save"); NSUserDefaults *defaults = [NSUserDefaults standardUse...

how do I POST a jpeg to a web form the way a browser would?

I need to upload a file to a form. This is a generic browser based upload I want to mimic. I have looked through the HTML documentation but I can't figure out how it works. right now I am using a URL to submit the rest of the form information "www.domain.com/form.html?field=value&field2=value2". This is all there is to the HTML for the...

PDFView printWithInfo:autoRotate: fails

I'm trying to print a PDFDocument that I am constructing from a series of images. In case it matters, I'm doing all of this from within a Mozilla plugin. I create the PDFDocument, and put it into a PDFView, then I call [printView printWithInfo: [NSPrintInfo sharedPrintInfo] autoRotate: YES]; The print dialog comes up (as a separate...

What's the best way to release objective-c properties?

I'm new to memory-management, and am reading different things about how to best release properties. If I have: in .h: @property(retain) NSString *myStr; and in .m: @synthesize myStr = _iVarStr; Should my dealloc have: [_iVarStr release]; or self.myStr = nil; or something else? Thanks! ...

NSData WriteToFile not synchronous

I'm trying to write data to the documents folder on the device. I'm getting the data from a subview that gets released the the file is written. The problem is that the view gets released before the file is written. I'm hoping that i'm doing something wrong in the code but i can't see it. (void)alertView:(UIAlertView *)alertView didDis...

How to convert and compare NSNumber to BOOL?

First I convert BOOL value to NSNumber in order to put it into NSUserDefaults. Later I would like to retrieve the BOOL value from the NSUserDefaults, but obviously I get NSNumber instead of BOOL. My questions are? how to convert back from NSNumber to BOOL? How to compare NSNumber to BOOL value. Currently I have: if (someNSNumberVa...

Writing to plists located at resource folder in iPhone

Any one please answer me, how to write into the plist file which is located in my resource folder. Please write an example code for me. ...