objective-c

Why does this JSON fail only in iPhone?

I'm using the JSON framework from http://code.google.com/p/json-framework. The JSON below fails with this error: -JSONValue failed. Error trace is: ( Error Domain=org.brautaset.JSON.ErrorDomain Code=5 UserInfo=0x124a20 "Unescaped control character '0xd'", Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x11bc20 "Object value...

Embed font in a mac bundle

I have a program I am writing. I want to use a fancy font. Can I just embed my font into my bundle and use it from there. My code... NSMutableAttributedString *recOf; recOf = [[NSMutableAttributedString alloc] initWithString:@"In Recognition of"]; length = [recOf length]; [recOf addAttribute:NSFontAttributeName value:[NSFont fontWi...

MPMediaItem - NSCoding problem with MPMediaItemArtwork

Hi, So MPMediaItem conforms to NSCoding, but it contains a pointer to MPMediaItemArtwork, which doesn't conform to NSCoding. So if I try to archive a MPMediaItem, if that item has some artwork in it, it will not be able to unarchive. I tried to make a category of MPMediaItemArtwork and make it conform to NSCoding, but I can't seem to d...

How different is Objective-C from C++?

What are the main differences between Objective-C and C++ in terms of the syntax, features, paradigms, frameworks and libraries? *Important: My goal is not to start a performance war between the two languages. I only want real hard facts. In fact, my question is not related to performance! Please give sources for anything that may seem ...

Is it possible to do some interop with iWork?

I know it is possible with the .NET framework of Microsoft to do some interoperability with Microsoft Office. Is there something that exist that resembles to it for iWork and the Cocoa framework? Edit: Here are more details. I would like to create an application that has a GUI and that can generate Pages/Keynote/Numbers documents. ...

passing argument 1 from incompatible pointer type

Why does this code...: NSDictionary *testDictionary = [NSDictionary dictionaryWithObjectsAndKeys:kABOtherLabel, @"other", kABWorkLabel, @"work", nil]; // There are 9 more key-value pairs that i've omitted here. throw this warning: warning: passing argument 1 of 'dictionaryWithObjectsAndKeys' from incompatible pointer type Incidental...

How can i get a list of currently running threads in objective-C(iphone)

Is there a way to get the list of currently running threads in objective-C? I'm mostly interested in getting the NSThreads objects, cause i want to replace the assertion handler for each running thread? If such thing is not possible, maybe i could set my own selector to be invoked after any thread is spawn(so that i could do the asserti...

How to nslog - copied text in iPhone?

Suppose - User has selected & copied some text in textField/textView/webView. Now I want to Log the copied text, But don't know how? How is it possible? Sagar ...

Schedule timer with NSTimer makes the task run faster than expected

I schedule a timer with NSTimer's function in viewWillAppear as follows: minutesTimer = nil; minutesTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(updateScrollViewItems) userInfo:NULL repeats:YES]; With this function call, I expect it to call the selector updateScrollViewItems every minute, but it do...

SQLITE no such table: error IPhone

Hey, Im have been using sqlite as a store in my app and everything was going fine problem is i changed my database schema deleted the old one and then inserted the new one in and now the application no longer loads any data despite all of the sql statements working fine whenever i run them in the firefox plugin. I have done a build clea...

Building Dynamic Classes in Objective C

I'm a somewhat competent ruby programmer. Yesterday I decided to finally try my hand with Apple's Cocoa frameworks. Help me see things the ObjC way? I'm trying to get my head around objc_allocateClassPair and objc_registerClassPair. My goal is to dynamically generate a few classes and then be able to use them as I would any other class....

NSARRAY Coding error

Can anyone notice an error in this coding??? NSString *textFilePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"txt"]; NSString *fileContents = [NSString stringWithContentsOfFile:textFilePath encoding:NSUTF8StringEncoding error:NULL]; practiceContent = [fileContents componentsSeparatedByString:@" "]; myScrollView = [[UIS...

HTTP Digest authentication in Objective -C using byte array as password

Hi, i am using asynchronous URL connection to access a resource from server which uses HTTP digest authentication. In my (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge delegate method i have the following code newCredential=[NSURLCredential credentialWit...

What format does NSKeyedArchiver save?

When I use NSKeyedArchiver is the data that is written a *.plist, I have seen some examples where people have the output file down as *.txt or even without an extension at all? -(void)saveCore { NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:...

Audio/Voice Visualization

Hey you Objective-C bods. Does anyone know how I would go about changing (transforming) an image based on the input from the Microphone on the iPhone? i.e. When a user speaks into the Mic, the image will pulse or skew. [edit] Anyone have any ideas, I have (what is basically) a voice recording app. I just wanted something to change as ...

Cut and paste out of/ into text fields in a separate window doesn't work

I have a Macintosh Mozilla plugin which puts up a separate window for login information. It seems to work fine, it gets keyboard events like typing and hitting return to hit the default button. HOWEVER, it doesn't seem to get cut and paste events. When I hit Cmd-v, the edit menu flashes, but nothing happnes. Is this a problem with my re...

Core Data: NSFetchRequest sorting by count of to-many relationship

Say I have an parent entity, each of which have a number of children. I want to get all the parents sorted by their number of children. Something similar to the following pseudo code: NSEntityDescription * entity = [NSEntityDescription entityForName:@"Parent" inManagedObjectContext:managedObjectContext]; [[NSSortDescriptor alloc] initW...

How can I store Google Maps search results in an array?

Hi All, I'm working on an app where I need to query Google for businesses near a current location. How do I go about storing them in an array? I don't want to exit the app and open Google Maps, I want to be able to display the addresses in a list format (Table View, I suppose). Any help would be greatly appreciated. Thanks! Thomas Ex...

Recording Audio on iPhone and Sending Over Network with NSOutputStream

I am writing an iPhone application that needs to record audio from the built-in microphone and then send that audio data to a server for processing. The application uses a socket connection to connect to the server and Audio Queue Services to do the recording. What I am unsure of is when to actually send the data. Audio Queue Services f...

Progressive download of images in a UITableView

Hi everyone, I'm developing on the iPhone and I have seen in the AppStore that the images are progressively downloaded in the UITableView... How can I implement that? My idea was to detect the showed content (which cells are shown) and download these images. My problem is that I don't know how to detect the showed cells! Is it the good w...