objective-c

Passing matrix of variable size to a method in Objective C

Dear all, I have a 2 by 2 square matrix with real intries that I want to pass to a method. It looks as; double coefficients[2][2] = { { 1.00, 0.6789140 }, {0.4446350, 0.4301290 } }; [self PrintOut:?????? andNRows:2 andNColumns:2]; - (void) PrintOut:(double ?????? andNRows:(NSInteger)rows andNColumns:(NSInteger)columns { // do some...

Objective C - Webkit external files causing 401

Hi, I'm currently using Webkit to display a mobile web on my iPhone app. The domain is password protected, so I pass the username & password to the request. It loads the main HTML page fine, however, even after passing the username & password, any other pages that the main HTML page loads (i.e css and js) are all returning 401. Is the...

Simple Tutorial to Create a Scriptable Cocoa Application (Scripting Bridge)

Can anyone point me to a really simple hello world type of application that introduces ScriptingBridge? Something that takes you step by step to creating a 1 class - 1 method project that can be instantiated from ruby/python/applescript, etc. I'm having a hard time wrapping my head around what is actually required to create a scriptable...

Determining which view touch was in for all touches

I want to determine which view touches occurred in for the entire application, for the purpose of logging touches so that I can go through the logs later and determine what the user did. I know I could subclass UIView and override touchesBegan/Ended to log those, but I am using many instances of UIButton, UISlider, etc in Interface Build...

Objective-C Removing Inherited Methods from a class

For a subclass, is there way I can remove/stop methods from super class implementation? (ie. nsstring has a method length. i want to stop "mystring" class from attaining the length method). ...

Where to store a small NSArray of NSDictionaries? Not in my yard!

I have a UITableView with some login form and I manually wrote the configuration values of the UITextFields in this NSArray as NSDictionaries. It is bothering because it's data in the code. I don't want data in my code! And I think that nobody wants that. Have you ever been in this situation? How would you dispose properly of this data?...

Algorithm to find an image in an array using minimum size constraint

Hello, I have an array containing image objects. I am looking for an image nearest my size constraint. For exemple I want an image equal to 400x600 or nearest. By nearest I mean nearest by size, a little bit bigger or smaller. I am not looking for an implementation just for an algorithm. Do you have an idea how to achieve this ? Tha...

how should nsdecimalnumber's be stored in the database?

What is the best way to store nsdecimalnumbers in a database? Numeric types like float, real and double are out, because it is important to preserve the precision for currency usage. The two alternatives I have considered are string and storing two ints, one holding the mantissa and one holding the exponent. The challenge facing the lat...

Why do I get a leak when using CFPropertyListCreateDeepCopy?

I am creating a deep mutable copy of a dictionary but for some reason am getting a leak. I've tried this: NSMutableDictionary *mutableCopy = (NSMutableDictionary *)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, sectionedDictionaryByFirstLetter, kCFPropertyListMutableContainers); self.copyOfSectionedDictionaryByFirstLetter = mutableCo...

In App Purchase open source implementations?

I'm looking in open source implementations on top of the In App Purchase, maybe with the server-side implementation. I know about http://urbanairship.com, but I prefer do it in-house. ...

Is there any reason not to return a mutable object where one is not expected?

I have a number of functions similar to the following: + (NSArray *)arrayOfSomething { NSMutableArray *array = [NSMutableArray array]; // Add objects to the array return [[array copy] autorelease]; } My question is about the last line of this method: is it better to return the mutable object and avoid a copy operation, or...

How safe is information contained within iPhone app compiled code?

I was discussing this with some friends and we began to wonder about this. Could someone gain access to URLs or other values that are contained in the actual objective-c code after they purchase your app? Our initial feeling was no, but I wondered if anyone out there had definitive knowledge one way or the other? I do know that .plist ...

Getting level of rotation with UIAccleration

Hello. Games like FroggyJump for iPhone figure out the rotation of the iphone. I'm getting confused with the acceleration values. How do I calculate the level of rotation? I suppose I need to consider when the iphone isn't perfectly upright. Thank you. I'm also wanting to use the new Core Motion framework with the "Device Motion" for...

Presenting a modal view controller immediately after dismissing another

I'm dismissing a modal view controller and then immediately presenting another one, but the latter never happens. Here's the code: [self dismissModalViewControllerAnimated:YES]; UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeSav...

[audio iphone maths] how to calculate the number of Packets for X seconds?

Hi guys, i'm tring to understand the Audio * things for iPhone currently i'm reading: core audio overview here i got a question: from apple example codes: - (void) calculateSizesFor: (Float64) seconds { UInt32 maxPacketSize; UInt32 propertySize = sizeof (maxPacketSize); AudioFileGetProperty ( audioFileID, ...

NSPrintOperation hangs application

I have an application that hangs whenever I call NSPrintOperation. I have a view that is creates a separate class (UIView) like this: PBPrintImage *printImage = [[PBPrintImage alloc] init]; printImage.image = finalImage; [printImage printWithNoPanel:self]; Then inside PBPrintImage I have the following method: - (void)printWithNoPane...

AES test on iphone

my encryption is working but i cant decrypt kindly suggest what i am doing wrong here NSString *passphrase = @"hello"; NSStringEncoding myEncoding = NSASCIIStringEncoding; NSString *alphaStringPlain = @"cell"; NSData *alphaDataPlain = [alphaStringPlain dataUsingEncoding:myEncoding]; NSData *alphaDataCypher = [alphaData...

Wrapping C++ class in Objective-C

I have a C++ library that doesn't use namespaces. I want to port it to Objective-C. The problem is the name collisions between the two. I want it to have the same name in Objective-C that is the name of the C++ object. But, I just can't figure out the best way to do this without it just becoming a mess. I am hoping for a solution to this...

UINavigationBar topItem/items seems to double-pop on back

I am managing my own UINavigationBar. I need to do this due to extensive skinning. The documentation for UINavigationController warns that there are limitations to skinning the UINavigationBar when used with a UINavigationController. I have put in extensive logging and from everything I can tell, pushing the "Back" button in the UINavig...

migrating an application from carbon to cocoa

Hi, I am working on an application in which I need to migrate the whole code of it from carbon to cocoa.I have experience in programming of C,C++,python and Java during my college time and internship but have never touched objective C or have done any programming for Mac(Carbon and Cocoa) before this. So Can you please suggest me some ...