objective-c

Binding NSSlider to control the zoom of an IKImageBrowserView

Hi, It turns out that in order to do this one has to bind the NSSlider's Value to IKImageBrowserView's zoomValue. My question is why it only works in this way? It seems more natural (to me) to bind IKImageBrowserView's zoomValue to NSSlider.intValue Thanks! ...

Asyncsocket VS NSstream

Hi, I have to create an sample code that connect to a socket server, and then be able to send multiple NSString through the socket. In the begging i start using NSStream objects, but i had a problem to reuse the socket (maybe i'll post another question if the nsstream solution is the best), and when i google socket for iPhone programmi...

Why do the variables behave so strange?

I thought an variable in objective-c is just a reference to an object somewhere in memory. So for my understanding, the result must have been "one", because at the end i assign the object's memory address of str1 to str2, and previously I had assignend the memory adress of str2 to test. NSString *str1 = [NSString stringWithCString:"one"...

Mixing C functions in an Objective-C class

I am writing an Objective-C class but is uses an API written in C. This is mostly fine as mixing C calls with Objective-C calls causes few problems. However one of the API call requires a call back method (example): success = CFHostSetClient(host, MyCFHostClientCallBack, &context); Where MyCFHostClientCallBack is a C function defined...

NSOuputStream writing multiple times

Hello, I'm trying to use the NSStream objects to open and then write and read on a socket but i have a problem. I don't know how to write on the socket, after i have opened it. Here is how i have done 1) first openning the socket : NSURL *website = [NSURL URLWithString:urlStr]; if (!website) { NSLog(@"%@ is no...

Objective-C on iPhone release problem

I have a problem that I am getting EX_BAD_ACCESS when calling release on an NSStream object in my dealloc on the iPhone. The following code - (void)dealloc { DLog(@"dealloc started for: %@",self); @synchronized(self) { lookupCount--; if (lookupCount==0) { UIApplication* app = [UIApplication sharedApplication]; app.ne...

Testing CoreLocation on iPhone Simulator

Is there anyway to test CoreLocation on the iPhone Simulator? All I require is to be able to set the location myself and have CoreLocation return it. ...

How can I print out the Memory Adress of an variable?

I'd like to print what's behind an &myVariable. I tried NSLog(&myIntVar); but it won't work. ...

Is it right to say, that the value of a pointer is a memory address?

As I understand that (or think I understand), a variable that is a pointer stores just a memory address in it's value. lets say: int x = 5; NSString *str1 = [NSString stringWithCString:"one"]; then the value of x is 5. That's what I see in the Debugger when I put a breakpoint there. but: the value of str1 is NOT "one". It's a memo...

"Refreshing" an XML feed on iPhone/Mac OSX

Hi all, I'm curious for those of you who are building iPhone apps based on REST/SOAP/XML-RPC or simply pulling down a dynamic XML feed, what does it mean exactly to you when a user says 'refresh' the feed? The straight forward way is to populate some collection, say an NSMutableArray, with whatever you bring down from the feed. If a wi...

Variables, Pointers, Objects and Memory Addresses: Why do I get this strange result?

After I thought that I've understood how they work, I tried this: NSString *str1 = [NSString stringWithCString:"one"]; NSString *str2 = [NSString stringWithCString:"two"]; NSLog(@"str1: %x, %@", &str1, str1); //bfffd3cc, one NSLog(@"str2: %x, %@", &str2, str2); //bfffd3c8, two str1 = str2; NSLog(@"str1: %x, %@", &str1, str1); //bfffd3c...

iPhone and Crypto Libraries

Hi, I think I'm going to have to use the Crypto libraries in my iPhone application. I wanted to ask you about the implications regarding the crypto export policy applied by Apple. Do I need to do something extra (such as filling forms etc.) 1) If I use hashing with MD5. 2) If I use symmetric encryption. Thanks, ...

Why does my instance variable behave so strange? Did I get it right?

For trying out some pointer stuff, I made an instance variable in an existing project. It's just declared like this: @interface PointerFun : NSObject { NSString* test; } I have no @property compiler directive, no @synthesize, so no getter and no setter. Just for testing. Then I have a method, where I try around some things with p...

alternatives to XCode for iPhone development? (OR: how to make XCode suck less?)

I've been a Java developer for 10+ years now, and have come to love the power that modern IDEs provide for things like refactoring, finding dead code, finding "usages of", etc. I'm starting to do some iPhone dev on the side, and am utterly frustrated by the lack of such features in XCode. There is no "find usages of this method/class" ...

Where are the best explanations of variables, pointers, references and memory addresses on the net?

Although I think that I've got that now (the light bulb is pretty bright now but still flickering a little bit), I'd like to read more stuff about pointers, variables, references, memory addresses, etc. Just the whole thing, i.e. what I have to understand when hearing thre term "reference" (think it's just a pointer, not sure). So let u...

Is It Necessary to Set Pointers to nil in Objective-C After release?

Title says it all I guess. Is there anything wrong with doing something like NSString * string = [ [ NSString alloc ] init ]; ... [ string release ]; or is there any value (other than best practice) in also adding string = nil; ? ...

Encode NSString for XML/HTML

Is there a way to HTML encode a string (NSString) in objective-c, something along the lines of Server.HtmlEncode in .NET? Thanks! ...

Is it valid to say that a Getter is the owner of the instance variable? Or who owns it?

Actually I would say: yes, the Getter is the owner. So anyone who calls the Getter is not responsible for freeing the memory. Or more precisely, the object itself is the owner, but the Getter acts as a delivery mechanism of the instance variable to others. Is that right, or did I get that wrong? ...

How to resolve Undefined Symbols error?

I'm getting this error Undefined symbols: ".objc_class_name_MyClass", referenced from: literal-pointer@__OBJC@__cls_refs@MyClass in infoViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status When referencing the static method below: [MyClass ClickComment:self.navigationController]; MyClass is defined in a st...

How do I update the UI in the middle of this thread?

Below is a block of code that runs in a separate thread from my app's main thread. How do I get the UI to update after each button gets its thumbnail? Right now it doesn't update until the whole method finishes. The buttons are already added to a UIScrollView. (LotsGridButton is just a UIButton with some extra properties.) - (void)fetc...