objective-c

How to set modification date every time NSManagedObject changes?

Every time one of my managed objects is modified, I want to store the date it was modified (in an attribute which is already in my data model), for convenience when I'm syncing with other clients. Is there a way to do this without A) re-writing all my setters manually or B) relying on myself to always change the modification date every ...

how to find if mapkit failed to get userlocation?

I want to find that if mapkit failed to get user location(fails to show blue blob at user location) and show alert and then relocate the location again.i don't want to use corelocation.plz help me. ...

how to run .java file or execute a java application in iphone simulator?

I have an application made in java.I have .jar and also the complete source of the project.I want to use it's classes in xcode means i want to use function in objective-c without converting them.Or is there a way to execute the whole app in iphone simulator or device.please tell me step by step.I have SDK 3.0 and xcode 3.1.4 ...

An IBOulet for an NSArray size in a Non-Controller Class

I have a class along the lines of: @interface Foo : NSObject { NSMutableArray *bar; } Foo isn't a controller -- it's responsible for some other logic that I want encapsulated. I'd like to have a label display the size of bar. If it was a value in a controller, I could simply make it an IBOutlet, connect it in IB, and everythin...

How to change time and timezone in iPhone simulator?

How do I change time and time zone in the iPhone simulator? ...

Append a newline to an NSString

I have this: if (soapResults != nil) { soapResults = [soapResults stringByAppendingString:@"\n"]; } But I get a warning: Assignment from distinct Objective-C type on build. When I run it on device I get: Program received signal: "EXC_BAD_ACCESS". from gdb. Any ideas how to append a newline to an NSString without getting a warn...

Sinlgeton object in objective C

I need some clarification regarding the singleton object implementation in Objective C. I have implemented the following code for the singleton object .. static MyClass *instance = nil; +(MyClass *)getInstance { @synchronised(self) { if(instance == nil) { instance = [[self alloc] init]; } ...

calling an application from other application

hello, I am writing an application in Objective-C whose functionality is to call and execute another application.Pls can i know the procedure???Let me also know where i need to keep the calling application which has to load and execute??? ...

Sqlite - "incomprehensible archive" problem

Hi! I am working on a iphone/Ipod touch project involving saving and fetching data from an sqlite database. It is working fine, but at some points in development i get this error (when the app starts): erminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSKeyedUnarchiver initForReadingWithData:]: inco...

Can a class extend two or more classes

Hi, Can a class extend two or more classes in Objective-C? ...

Core Data / Cocoa : @distinctUnionOfObjects not returning a usable NSArray*

Hi there, I have an application that uses Core Data that has a relationship that I would like to group by. I have NSManagedObject classes that were generated by my .xcdatamodel file, and everything seems to be working OK for the most part. Given a parent / child relationship, I would like to do the following: A parent has a collection ...

How to remember and load selected date in UIDatePicker?

I have a UIDatePicker that well, allows you to select a date (not time). I then save this NSDate and use display it in a label on a different view. However, when I load back the view with the UIDatePicker, if the user has already selected a date, I want it to show that selected date (using NSDefaultPrefs). How do I do this? I know how t...

@property not getting set with new value

I'm building an iphone app that uses table views contained within UIViewControllers pushed onto a UINavigation controller (very similar to the Contacts app). When you touch a particular table cell it pushes a new view controller onto the navigation controller to allow you to select a value from a table view list. When you select and to...

How to find caret position in an NSTextView?

Hi all, I've an NSTextView with with several semi-colon separated strings. I need to find on which of those strings the caret has been placed. How could I do that? ...

How to use NSCoder

I am developing iphone application. I use NSCoder. MyApplication.h #define ITEMS_KEY @"items" #define CATEGORIES_KEY @"categories" #import <UIKit/UIKit.h> @interface MyApplicationData : NSObject <NSCoding, NSCopying> { NSMutableArray* items; NSMutableArray* categories; } @property (nonatomic ,retain) NSMutableArray* items...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values varies. The problem is that the number pad does not contain a key for entering a decimal point. When I lock my phone, the number pad that com...

updating a variable in appDelegate

In the application delegate, I created an array for multiple view controllers to reference. However, when I try to update the array in one view, it comes up empty in the other. View 1: MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; dataTempForSearch = appDelegate.myData; I then have an xml...

Showing a UIActionSheet

I was wondering how to show a UIActionSheet from the bottom of the screen. I have tried using the showInView: method with MainView as the view to show it in but I get the MainView Undeclared error. ...

NSMutableArray values becoming "invalid"

Hi all, I'm trying to show a database information in a tableview and then the datailed information in a view my problem is as follow: I created a NSMutable array: NSMutableArray *myArray = [[NSMutableArray alloc]init]; Then I populated it form a database MyObj *obj = [[MyObj alloc]initWithName:idObj]; When I show the values in the ta...

how to collect system info in osx using objective c

Is there any method / API defined to collect system info in osx. I want to write utility which will collect hardware information like CPU,RAM,Network adapter. Any idea ? Thanks in advance. ...