objective-c

Objective c webservice error

Hi, I have an error when calling a .NET webservice from objective c This is my code: -(IBAction)buttonClicked:(id)sender { NSString *postString =[NSString stringWithFormat:question]; NSLog(postString); NSURL *url = [NSURL URLWithString: address+@"?op=execute"]; NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; NSS...

Objective C - KeyValuePair class?

I'm looking for a class in Objective C similar to C#'s KeyValuePair (even without the generics). Just anything that has a first/second object. I can create my own with no problem, but I figure if one is already there, then there is no need to re-invent the wheel. I have not had any luck findind one myself... Does anyone know of one? ...

How can I prepopulate "Add Event" fields when user clicks date in iPhone UIWebView?

Since iOS3, the UIWebview component has had the ability to automatically detect and highlight dates within a UIWebView. Pressing the date brings up an actionsheet with an option to "Create Event" in the local calendar app. Unfortunately, the modal dialog that appears next contains ONLY the date, and no other information about the event. ...

iOS custom URL scheme for contacts app?

Hi Everyone, So I am trying to write an app that does a person search of my company. When it returns a result, I want to include a feature to add the person to the iPad contacts app with the push of a button. The problem is I can't find a way to launch the contacts app through a custom URL scheme with the person info as parameters. Do...

uikeyboard return

Hello all, I have one view name:myplay.h and myplay.m my view contain one textfield name txtplay.. It contain one button name btnplay. In button event i want to check that if uikeyboard is open then close it. I know below code - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return TR...

Objective C/Xcode error: The file “Info.plist” couldn’t be opened because there is no such file.

Hi I hope this error doesn't sound stupid. However, I receive this error and I don't know how to fix it. What happen is that I deleted the whole Resources folder before and copied in a new Resources folder. Could anyone help me fix this? Thanks. ProcessInfoPlistFile /Users/tohchinsheng/Documents/cocos2d-output/Debug-iphonesimulator/U...

Resizing UIPopover and its UITableView programmatically

Hello folks, I have a UIPopoverController which loads with a custom controller which is a subclass of UITableViewController. It serves to present a number of suggestions, under a search bar. When my popover opens the UITableView inside it show as many rows as possible; the first ones show the choices I set up, the last ones are blank. W...

How to read and parse an .xml file

I need to simply read an .xml file; like this: <exchanges> <exchange> <timestamp>2010-08-19 17:15:56</timestamp> <userid>Elijah-Woods-MacBook-Pro.local</userid> <clientname>elijah</clientname> <botid>Jarvis</botid> <input>firsthello</input> <response>Hello, sir. How may I help you?</re...

optional parameters

I have taken (with the authors permission on the site) a wrapper class for writing fetch requests to my Core Data stack. The guy who wrote it says it has "optional parameters" and I wondered what this meant. Anywho, the static methods are written as such... +(NSMutableArray *) searchObjectsFromContext : (NSString*) entityName ...

Comparing two NSMutableDictionaries

Hello fellow Computer People! I could do this myself, but was just wondering if there was a more efficient way that I haven't though of: I have two NSMutableDictionaries. Let us use these as an example: Dictionary 'Madrid' Bob : 54 Thomas : 32 Frank : 20 Dictionary 'Barcelona' Bob : 1100 Thomas : 32 Ed : 55 ...

How to change color of status bar item title in objective-C/Cocoa?

//Create the NSStatusBar and set its length statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; [statusItem setHighlightMode:YES]; [statusItem setTitle:@"myTitle"]; [statusItem setToolTip:@"myToolTip"]; [statusItem setMenu:statusMenu]; [statusItem setEnabled:YES]; How to change color of...

Is it possible to track all methods called on an object?

I'm still working on my problem that an NSView in NSMenuItem is not receiving any notification when the user chooses it by pressing the return key. For this i want to log all methods which are called on an Objective-C object. Can i do this in some way without using a debugger? ...

Replicating Style of Copy/Paste Pop-out.

How would I replicate the style of the Copy/Paste pop-out so I could put custom buttons inside it. I don't think it's a public class so how else would I do this? ...

App crashes when I rotate phone for the first time

App only crashes the first time i rotate my phone (EXC_BAD_ACCESS). Anytime after its all gravy. It only crashes on device too. Simulator everything is good. #import "ImageViewController.h" #define degreesToRadian(x) (M_PI * (x) / 180.0) #define ZOOM_VIEW_TAG 100 #define ZOOM_STEP 1.5 @interface ImageViewController (UtilityMethods) - (...

App loads images over wifi, but not 3g

I am having a really weird issue. My app runs great on wifi, all of my images load from the net. If i run the app for the very first time on 3G, images wont load. If I switch to wifi, then switch back to 3G, images will load (new images load as well as they change). I have no idea how to diagnose. ...

Change desktop picture in objective-c

How do you change the desktop picture in cocoa/objective-c? I've tried using defaults but had many errors. NSArray *args=[NSArray arrayWithObjects:@"write",@"com.apple.desktop", @"Background", @"'{default = {ImageFilePath = \"~/desktop.jpg\";};}'", nil]; NSTask *deskTask=[[NSTask alloc] init]; [deskTask setArguments: args]; [deskTas...

Objective-C error EXC_BAD_ACCESS help please

Hello, I am currently using the pragmatic screencast on Objective-C to help me program in objective-c. I have a background in Java and C++, but I am having a very difficult time getting used to everything in Objective(Mostly because I am not comfortable with the syntax). Below is the error I am receiving with all the code. I am also get...

iPhone add to favorites function

Hello, I'd like to add a function to my app where users can select favorites. I've got a list with games and I want a button in my tabbar saying: "Add". Now this isn't a problem. But when you click add, I'd like a modal view to come up in which you can select multiple games (which then show the CheckmarkAcessory). And If you then click ...

NSString alloc/init generates 'Redefinition of myStr' error.... ???

Howdy all, I seem to be generating a lot of questions with this one little iPhone app.... I am attempting to stuff an NSMutableArray with NSStrings, and I am working like this: ... NSString *myStr = [[NSString alloc] initWithString:@"Jupiter II"]; [txtArray addObject: myStr]; [myStr release]; NSString *myStr = [[NSString alloc] init...

NSCollectionView inside another NSCollectionView

Hi guys, I have these two classes: @interface Father : NSObject { NSString* name; NSArray* listChildren; } @property (copy, readwrite) NSString* name; @property (copy, readwrite) NSArray* listChildren; @end @interface Child : NSObject { NSString* nameChild; NSImage* picture; } @property (copy, readwrite) NSStrin...