objective-c

passing pointers or integral types via performSelector

I am mixing Objective-C parts into a C++ project (please don't argue about that, its cross-platform). I now want to invoke some C++ functions or methods on the correct thread (i.e. the main thread) in a cocoa enviroment. My current approach is passing function pointers to an objective-c instance (derived from NSObject) and do performSel...

Lotus Domino Server Access from iPhone

Hello, I am new to lotus notes and domino server. I want my iPhone application to have access of domino server. I want to get Contacts from domino server in my iPhone Application. I googled for it,I found many documents. but I couldn't find perfect data flow for that. can any one explain me how can i get Contacts/Calendar/Mail from dom...

NSURL path doesn't understand a plus sign in a URL

Hi As you know a plus sign in a URL translates to a space character. [NSURL path] returns a path replacing all %xx with corresponding characters. But it doesnt translate '+' to a space! It leaves it as a plus sign. Is it a bug or what? How can I use NSURL to work with URLs which contain spaces encoded as pluses? thanks ...

Writing a masked image to disk as a PNG file

Basically I'm downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I'm using the masking code everyone seems to point at which can be found here: http://iphonedevelopertips.com/cocoa/how-to-mask-an-image.html What happens though, is that the image displays fine, but the version...

Memory leak when using UIwebview

Hi! Im in the final stages of my first iphone sdk project. I have been working hard to remove memory leaks from my app, and have mostly succeeded at it. But there I am struggling with one of them. I have a contact screen with a button that fetches a webview, but only if there is a network connection. If not an alert pops up. This works ...

obj-c NSArray count comparison fail

NSArray *test1 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSArray *test2 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSArray *test3 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSLog(@"%d", [test1 count] == [test2 count] == [test3 count]); Will print 0. Why? ...

View swap using push animation

I want to swap out one view with another by pushing the old view aside to slide in a new view (the kCATransitionPush type). To use CoreAnimation I need to work with CALayers with my views. The problem is that attaching a backing layer to my window content view through setWantsLayer distorts everything in the view. I'm not sure if this h...

Where register an object as Notification listener? - Maximize performance!

Hello, there is a better place where an object can be registered to a Notification Center? In other words, for a matter of performance, it's a good practice to register an object as Notification listener in the init(), awakeFromNib() or other event handler? Thanks! ...

How can I get rid of this conflict type warning?

Objective-C Conflict types for '-(NSInteger)amountYear:(NSInteger)searchYear Month:(NSInteger)searchMonth' How can I get rid of this warning? .m #import "MyAppDataController.h" #import "MyApplicationData.h" @implementation MyAppDataController @synthesize appdata; static id _instance = nil; + (id)instance { @synchronized(self) ...

iPhone UILabel text soft shadow

I know soft shadows are not supported by the UILabel our of the box, on the iPhone. So what would be the best way to implement my own one? EDIT: Obviously I will subclass the UILabel and draw in the -drawRect: My question is, how do I get the contents of the label as graphics and draw around them, blur them etc... ...

Setting nested objects?

I am just trying to make sure I am getting things right as I move forward with Objective-C, two quick questions if I may: (1) Am I accessing the Position object correctly from within Rectangle? am I right to access the Position object contained within by the pointer I set in the init, or is there a better way? (2) In [setPosX: andPosY:...

out of scope - NSMutableArray error

data = [[NSMutableArray arrayWithCapacity:numISF]init]; count = 0; while (count <= numISF) { [data addObject:[[rouge_col_data alloc]init]]; count++; } When I step through the while loop, each object in the data array is 'out of scope' rouge col data 's implementation looks like this.. @implementation rouge_col_data @synthe...

How To Pass a Dictionary To a Function

Alright, so I think I'm doing this the right way. I'm new to objective-C, so I'm not sure about the syntax... I have a set of code that I need to call multiple times, from different files. So I made a new class that has a method in it that I'll call and pass it the values that it needs. Because I am passing different values I've put ...

Add contact to addressbook in iphone objective-c

What is the correct way to set street address etc in addressbook and let the user save it on iphone? EDIT: removed the specific code-problem and made it more general ...

Objective-C and Windows

I am currently in a class that is developing applications in Objective-C and Cocoa. I was wondering if there was any way to build and compile Objective-C applications on Windows Vista. During class, we are able to use the Mac machines provided to us, but I was hoping to do some work outside of class, and I only have a Windows Vista machi...

Playing generated audio on an iPhone

As a throwaway project for the iPhone to get me up to speed with Objective C and the iPhone libraries, I've been trying to create an app that will play different kinds of random noise. I've been constructing the noise as an array of floats normalized from [-1,1]. Where I'm stuck is in playing that generated data. It seems like this sho...

Primary Key behaviour in Core Data iPhone

I am making an app that parses feeds from xml and stores them using Core Data. The issue I am dealing with at the moment is duplicate entries. Every feed I am parsing contains a unique id, something that I get in my model as an int. Now what I need is to tell Core Data not to store that entity if another with the same id already exists. ...

%d doesn't show integer properly

As I try to write NSLog(@"%d", myObject.myId); where myId is int, console gives some hight number like 70614496. And when I use @"%@", I get exception -[CFNumber respondsToSelector:]: message sent to deallocated instance 0x466c910. Why is it so? Here's definition of myObject: @interface myObject : NSObject { int myId; NSString *titl...

IF Statement Seems To Work Fine On Simulator, But Not On Device!

Hi Guys, Ok, the problem is that when my app runs on the simulator it seems to work fine. On the device, however it does not update all the labels. I think the error is somewhere here: - (IBAction)buttonclick1 { self.startDate = [NSDate date]; double value = [self Level]; double value2 = [self Level2]; if ((va...

Downloading image into bundle?

I display text and images in a UIWebView. Content isn't always the same. I access images within the content using the bundle path. For an inbetween versions update of content, I'd like to allows users the ability to download new content (text & images). This new content will also display in a UIWebView. The problem is I will have to...