objective-c

How to store non-objects in a dictionary?

I tried storing a selector(SEL) in a NSMutableDictionary and it caused a crash, probably because the dictionary tries to dereference it as an object pointer. What is the standard recipe for storing non-objects in a dictionary? ...

What is the difference between *(id *)((char *)object + ivar_getOffset(ivar)) and object_getIvar(object, ivar)

According the Objective-C runtime reference: ivar_getOffset Returns the offset of an instance variable. ptrdiff_t ivar_getOffset(Ivar ivar) Discussion For instance variables of type id or other object types, call object_getIvar and object_setIvar instead of using this offset to access the instance variable data dir...

Memory managment question

I have a button with IBAction, which shows another window: -(IBAction)someButtonClick:(id)sender { anotherView = [[NSWindowController alloc] initWithWindowNibName:@"AnotherWindow"]; [anotherView showWindow:self]; } I worry about memory management in here. I allocate an object in this IBAction and don't released it. But how ca...

Problem in adding data in sqlite3

I am having a date datatype to be added into the database but i dont know how to insert the date datatype into the database ` +(void)insertbarcodeid:(NSString *)barcode brand:(NSString *)brand productname:(NSString *)productname productsize:(NSString *)productsize productcategory:(NSString *)productcategory productopendate:(NSDate *)prod...

OpenGL render issue

(Also asked on the Apple Developer forums) I am new to OpenGL, so be kind :). I seem to have a rendering issue with OpenGL. My app is supposed to draw a line as the user traces his finger across the screen. So, touchesMoved calls the draw function below and passes a NSMutableArray currentStroke which contains point data. The issue I am...

How to pass unichar object?

I need to pass a character to the line no. 2: First method I tried, 1) unichar dicttxt = [[myword lowercaseString] characterAtIndex:0]; 2) fileName = [[NSBundle mainBundle] pathForResource:dicttxt ofType: @"txt"]; 2nd Method I tried, NSString *dicttxt = [[myword lowercaseString] characterAtIndex:0]; fileName = [[NSBundle mainBun...

A question related to NSUserdefault class

In ApplicationWillTerminate method NSString *state; this statement declares in AppDelegate method NSString *string1 ;this statement declares in AppDelegate method NSUserDefaults *def = [NSUserDefaults standardUserDefaults]; [def setObject:state forkey:@"integer"]; In ApplicationDidFinishLaunching method NSUserDefaults *def = [NSUserD...

Objective-C call function on another class?

Hello, Here are my objective-c classes: AppDelegate SomeScript How might I call the function loggedIn on the SomeScript class from the app-delegate or any other class? Thanks, Christian Stewart ...

How to add dropdown menu in toolbar

How to add dropdown menu in toolbar, without any bevel effect????? ...

Exception while retriving data from Address Book.

I am getting this exception while retriving data from address book. I have check through internet but not get any help for that. Overflow allocating bitmap backing store. Cannot back bitmap with 320 bytes per row, -2147483648 height, and 1 planes I am using AddressBook Framework for retriving data from Address Book. is this issue o...

Problem when uploading an image file along with the audio file in to JSP server

Hi all, I am implemenging a server based application. In that I need to upload some values, image file and audio file. But it is taking only one file at a time. I looked into the code flow but there is no problem in that. Why I am confident is if I comment out the code of uploading the image then the audio file is uploaded perfectly. Wh...

How to get Domain Name of ipAddress and ipAddress from Domain Name in objective-c

I am able to get the current ip address of my device/machine that I am using - by using this question's answer. I have gone through this question. Java allows to get the IPAddress from a domain name. Is it possible in objective c ? How ? The second question is How to get the name of device/machine by using it's IPAddress. Say for examp...

Getting problem when uploading the data in server in iphone sdk

Hi guys, I am getting a problem when I am uploading the data to server. Actually my code seems like this: -(void)publishToServer:(AddDetailsObject *)aCustObj { NSString *urlString = @"http://219.91.165.17:8080/uploadIphone/upload.jsp"; UIImage *theImage = [UIImage imageWithData:custObj.picture]; NSData *imageData = UIImageJPEGRepre...

How do I determine which path my application is run from?

I'm creating a little program to copy the Domain file for iWeb over to a USB stick or external harddrive or such. The program is meant to be run from that USB stick or external harddrive, and then create a directory where the application is run from. E.g. the application is run from ~/Documents, the application should create a folder at ...

How to delete the char in the NSString?

Hi, everyone, I have a question about the objective-C. I have the following string NSString *data = @"abcdefghi"; but I want the data to be the "defghi" What can I do? Can anyone help me? Thank you. ...

regarding the controlling user in iphone for music

[english translation] I have the application which allows the users to play songs. I want to allow the user to listen to a maximum of three songs before forcing the user to log in. The user should be able to listen to these three songs during the course of the day, but if they still haven't logged in they should no longer be able to l...

shouldAutoRotate method not working properly..?

Hello Friends,I have used multiple uiviewcontrollers in my split view based ipad application. There are web services. For some particular web services (e.g Logout) i need to remove split view and insert new view i.e Login Screen. but most of times shouldAutoRotate method of Login view doesnt gets called resulting in dumb app which do no...

know the position of the finger in the trackpad under Mac OS X

Hello, I am developping an Mac application and I would like to know the position of the finger in the trackpad when there is a touch. Is it something possible and if yes, do you have any idea to achieve this? Thanks in advance for your help, Regards, ...

Objective-C Block which accepts an object and returns a boolean.

Can you please write for me a block which conforms to this definition: (BOOL(^)(id))block. The closest I have gotten is: typedef BOOL (^birds)(MyObject*); birds c = ^(MyObject* p){ return (BOOL)[p.something boolValue]; }; But it seems passing this c in a message who wants (BOOL(^)(id))block is a no go. ...

Removing retain from implementation crashes application even though property is set to retain

This question follows on from a previous question. However stackoverflow presents me from commenting - like it sometimes prevents me from setting a correct answer on my own question. Anyway I have some weirdness happening in my application. I have a property: @property (nonatomic, retain) NSMutableArray *hotelList; //I also synthesiz...