objective-c

Example socket programming in iphone

I am learning objective C.I like to know about client/server(socket) programming for iphone. I went through many answers,but still having many confusion with that flow and working.Can anyone help me out with code. Thank U!! ...

ObjectContext for OData in iPhone App NSThread

I am writing an app that consumes an OData feed and I am creating my proxy which inherits from ObjectContext in a NSThread. The first time a call is made with any execute on the proxy itself or on a query object, the debugger is fine. The subsequent calls fail and it looks like the debugger freaks out. Does any one have any idea of why t...

What tools might I use for generating documentation for an Xcode project?

I am wondering which tool can be used in Xcode to generate the documentation for an iPhone project, so written in objective-C and C mostly, but also helping designing the code. The documents I'd like to be produced are: UML-like class diagrams (with generalization, aggregation and composition relationships) UML-like components diagram ...

How to set content offset and content size in a UIWebView

I have had to change a UIScrollView into a UIWebView due to formatting reasons. There is a problem though that I need to be able to get the content offset back to 0, 0 (as I am using reusable UIWebViews and changing content) and get the content size so I can place a button at the bottom; but UIWebView does not seem to have this. ...

Creating IBOutlets in loop interface

I'm sure there's an easy to do this: for (i=0; i<10; i++) { IBOutlet UIButton *button+i; } instead of this: IBOutlet UIButton *button0; IBOutlet UIButton *button1; IBOutlet UIButton *button2; IBOutlet UIButton *button3; IBOutlet UIButton *button4; IBOutlet UIButton *button5; IBOutlet UIButton *button6;...

Separate key:value-string to NSDictionary

Hi, I have a string like this: "(list:\"RTM API\" status:completed)" And I want to convert it into a NSDictionary with the "value" before the colon as the key and the value left of the colon as the value - like this: list: "RTM API" status: "completed" It can probably be done using a simple regex or so, but I don't really know how...

UIView does not sizeToFit child views

I am creating an expandable view control which I would like to expand to the size of the child controls, however if I try to use the sizeToFit method nothing happens and sizeThatFits simply returns the current views size Any suggestions?!? ...

Help with Objective-C variable declaration syntax

Is there a difference between these two declarations? Is one better practice? NSString* hello = @"HelloWorld"; NSString *hello = @"HelloWorld"; Thanks-- ...

Insert NSMutableDictionary with NSDictionaries

I tried to insert NSDictionary's in a NSMutableDictionary. There is noch Error but it won't work :-( It's empty like before. Here's my code: NSMutableDictionary *einnahmen = [[NSMutableDictionary alloc] initWithCapacity:20]; NSArray *objects = [NSArray arrayWithObjects: name, [NS...

dynamic 2D arrays in C / Objc

Hey guys I was wondering how I should do dynamic arrays in objc. Currently I have a function I wrote called malloc2D that looks like this: void* malloc2D(size_t unitSize, uint firstCount, uint secondCount){ void** pointer = malloc(sizeof(id) * firstCount); for (int i =0; i < firstCount; i ++){ pointer[i] = malloc(unitSize * second...

What is an effective way to hold a universal constant on an iphone app?

Hey, I'm trying to create an iPhone app in which I connect to an API and get a security string and id with which to make requests to the api. The string and id change every time the app is run, and multiple view controllers in the application need the information. How can I effectively store that information so it can be easily access...

NSNetServiceBrowser delegate not called when searching

I got a really annoying problem. Im trying to search after a NSNetService (that i know exist). I've copied the example code from http://www.macresearch.org/cocoa-scientists-part-xxviii-bonjour-and-how-do-you-do into my own application. I can see (in the example program) that my service is created. But when i hit search, and start a NSNe...

NSString long date format to NSDate

I have a string in the form of "11:00AM, Saturday August 21, 2010" How do I convert this to an NSDate object? ...

Example of NSTask performing complex pipelines

Can someone post code to show this? Elijah ...

bundle a file with a command-line utility

can i bundle a file with a command-line Utility in OS X? i use Foundation framework, and hope there is a way to drag some files to project and then use them in code, like in Cocoa ...

Need to get the Values of the altitude or Zoom level in MapView.

Hi all, I am implementing a MapKit based application. I need a clarification that, it is possible to get the altitude or Zoom level of the mapView when we zoom in/out in the Map.Because based on that I need to call some events. Please help me on this. Thanks in advance, Sekhar Bethalam. ...

Is it ok to autorelease UIViewControllers?

I have some view controllers: StockTwitsTVViewController* stvViewController = [[[StockTwitsTVViewController alloc] initWithNibName:@"StockTwitsTVViewController" bundle:nil]autorelease]; UINavigationController *stvNavController = [[UINavigationController alloc] initWithRootViewController:stvViewController]; stvNavController.tabBa...

How to inject JQuery into existing page within a UIWebView?

I am trying to inject JQuery into a UIWebView of a page that I can't control, say Google, for example. When a UITextField gets focus, I am executing the following lines of code: NSString* scriptInject = @"var headElement = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.setAttribute(...

How would I run an .sh file using NSTask and get its output?

I need to run an .sh file and get its output. I need to see the setup of the file as well. The .sh file simply runs a java app through terminal. Any ideas? I'm truly stuck on this..... Elijah The server.sh file: echo Starting Jarvis Program D. ALICE_HOME=. SERVLET_LIB=lib/servlet.jar ALICE_LIB=lib/aliceserver.jar JS_LIB=lib/js.jar ...

Testing application on iPad device

Hi all, I need to get the statistical details( memory details, object allocations etc.) , when my app is running on the actual device. Not in the simulator. Is there a way to attach the instruments or some other tool to device? ( When i build and debug on the device from xcode). Is it true that memory details that shown in the simulato...