I feel a little dumbfounded. I know how to store any kind of "plist supporting" data in a preferences file, such as NSArray, NSDictionary, NSString and their CF counterparts. No problem there.
Now I like to store the values of my custom object this way. I had thought that if I implement some kind of serialization/archiving protocol, I c...
Here's a very basic C snippet to open and read a file:
int fd = open("test.txt",O_RDONLY);
char buf[128];
int reader = read(fd,buf,128);
int i;
for (i=0;i<strlen(buf);i++)
{
printf("%i: I read: %c", i, (int)buf[i]);
}
I'm also including these standard headers:
#include <stdio.h>
#include <stdlib.h>
#include <...
Hello guys!
I'm trying to detect if a rectangle or a circle contains a point. It is not so hard, but I want to know that is there any built-in method in objective c for this? Thanks!
...
Hey guys,
I was wondering how it can be that iterating through an NSMutableArray works, but when I call objectAtIndex it fails with "*** -[NSCFSet objectAtIndex:]: unrecognized selector sent to instance 0x..."
Here is some sample code, the program is too big to share in whole so I hope it's enough. The code is executed in the latest iP...
I've added a feature to my app that allows the user to save a business's contact details to the address book; however, to guard against adding multiple entries I want to check that the entry doesn't already exist.
Any idea how to do this? The iPhone developer documentation seems a little unclear. I'm using the C api to add the contact.
...
Hey guys,
I can't seem to load an image, but I'm sure it is at the path I specify.
Here is the code that tries to load the image:
- (UIImage*) CPPlistImageToUIImage: (NSString *) CPPlistImage {
/*TODO: Is this a memory leak? Find out*/
UIImage * ret = [UIImage imageNamed: CPPlistImage];
if(ret == nil){
RDLogString(@"W...
I want to intercept messages sent to a proxy object by just printing the selector and arguments. Even if the proxy does not implement them and does not have a target object. Please help. I have looked at several options and Apple docs but they assume that you already know the target object. I want to do this cleanly without memory issues...
I am working on making a search bar above the UITableView, like in the iPod App or Mail app. In the iPod App when you start to type in the search bar the navigation controller disappears and the UISearchBar goes to the top. The animation hasn't been too bad to create, but I want to make sure it behaves exactly like the other search bars ...
I have a TableView that builds and draws ok, but then crashes on scrolling the view. I've run through the debugger and it appears that my class level variables are being overwritten somehow so they no longer exist when the titleForHeaderInSection is being called again. The very strange thing is that if I replace the code:
-(NSString *...
I don't know the best way to let an App restore the navigation controller stack so that the app will re-launch in the same way that it was exited.
...
A developing consensus among the iPhone developer community is that Apple has recently started using a static code analysis tool to detect use of undocumented API calls.
Just for the sake of the argument, I wonder if it would be possible to work around this tool by generating the invocation at runtime like this:
NSString *const aMethod...
I'm working on an iPhone application. I added a new framework to my project, and this caused a bunch of linking errors, with the following error for each framework I'm using:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation, missing required ...
I have a double which is:
double mydouble = 10;
and I want 10^12, so 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10. I tried
double newDouble = pow(10, 12);
and it returns me in NSLog: pow=-1.991886
makes not much sense... I think pow isn't my friend right?
...
I would like to run a shell script, from a file or from an objective-c string (within the code). I would also like the shell script's result to be stored to a variable. I would not like the shell script to be split into arguments (such as setLaunchPath when I run it). For example: running this shell script "mount_webdav idisk.mac.com/...
I am having a problem that is eating me alive. I really hope I am just missing something small here. It appears to be a rather "n00b" issue.
I have a blank NSImageView that I want to display a picture when a button is pressed — simple as that.
Here is my line of coding
NSBundle *mb = [NSBundle mainBundle];
NSString *fp = [mb pathForRe...
Im trying to parse twitter trends but i keep getting a parser error at "as_of". anyone know why this is happening?
EDIT:
Here is the code im using
NSMutableArray *tweets;
tweets = [[NSMutableArray alloc] init];
NSURL *url = [NSURL URLWithString:@"http://search.twitter.com/trends/current.json"];
trendsArray = [[NSMutableArray alloc] i...
Hello!
I want to create a Class object in this way:
Class c = [Class classNamed:[NSString stringWithFormat:@"%sview", [_shapeClass name]]];
My problem is this error message: "error: expected expression before 'Class'".
What do you think? What's the problem? Thank you for replys.
Edit:
I want to do this in a switch case.
...
Hi
I have made an iphone fitness application.
The issue i am unable to resolve here is that, while the application is running, the iphone goes in the sleep mode, and hence the accelerometer and sound turns off. Which i dont want to happen.
Is there anyway i can avoid this from happening? If not that, atleast i could increase the time...
Hi there,
I'm experimenting with Core Data, plist files, flat files and sqlite.
I can't seem to differentiate in terms of efficiency for small data sets.
In terms of the differences on the surface ( i.e the API ), i know the difference.
But what I'm trying to get a feel for is which persistence model is best for which situation.
Thank...
I've been pondering over this question for a long time already.
On the one hand, Interface Builder offers a really easy way to design the interface and wire the elements up with objects in code.
On the other hand, in larger projects, Interface Builder becomes a hassle to maintain.
Any suggestions would be greatly appreciated.
...