objective-c

Prevent duplicates when importing RSS feed to Core Data

Trying to import a RSS feed into Core Data. Once they are imported, when trying to update the feed again afterwards, how do I most efficiently prevent duplicates. Right now it checks every item against the datastore during the parsing, which is not very efficient. I looked into the Top Songs sample from Apple. It uses a least recently u...

About Iphone Programming ScrollView Displaying

How To display ScrollView on iphone ...

UIView drag event

I have an slide show application. There is a UIView on main screen, I want when someone slide his fingers horizontally it moves to next screen. What this event is called? (slide fingers horizontally/vertically) How can i detect this event? Want to call a method xyz on this event ...

XML Parsing using objective c

I m trying to Retrieve the data from XML File into an IPhone application. The XML File Which i used is : <note> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> <URL>http://192.168.1.75/one.png&lt;/URL&gt; </note> In this XML I have retrieve the text but i failed to display the image from the link in the X...

With obj-c on the iPhone, is there any harm in autoreleasing everything instead of releasing?

Hi all, With obj-c on the iPhone, is there any harm in autoreleasing everything instead of releasing? Eg, this code: NSString *recipe = [[NSString alloc] initWithUTF8String:sqlite3_column_text(dbps,0)]; [arr addObject:recipe]; [recipe release]; Can be shortened to two lines by autoreleasing the recipe nsstring when i create it: NSS...

Download content of app at download of application

Hi all, My problem is that my application size is very high. so i want that user download application and when required content then content is downloaded in user iphone memory. and if one time downloaded content then user never required to download content again and again. is it possible? please tell me if any reference. Thanks, Ar...

How to handle multiple properties on iPhone's addressbook?

The problem is that I always get runtime crashes at any method invoked at phones variable. At this version I get an error at 1 (ABMultiValueCopyValueAtIndex). If I'll comment this line, the code crashes at 2 (ABMultiValueGetCount). It looks like the property was empty. If I NSLog the phones variable. I get (null). I test the code on iPho...

When converting a NSString to a char* using UTF8String, how to retain it?

When converting a NSString to a char* using UTF8String, how to retain it? According to the following link, when you use UTF8String the returned char* is pretty much autoreleased, so it won't last beyond the current function: http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSString_Class/Referen...

Using Sqlite in iphone development: if i open the database in the init function, it's inaccessible in my other functions. Any ideas?

Hi, I'm trying to use sqlite in a 'data services' class like below. I keep getting an error code 1 when calling 'sqlite3_prepare_v2'. The logs certainly back up that the database is getting opened before my recipeNames function is called. I'm so stumped! Is it a memory management thing with the sqlite3 *db ? Eg is it getting freed when i...

iPhone 3.x and 4.x: shouldAutorotateToInterfaceOrientation is returning TRUE, but nothing happens

shouldAutorotateToInterfaceOrientation is definitely being called... but when I rotate the iphone... or the simulator... nothing changes. I thought all I had to do was this: -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { NSLog(@"this is being called ok"); return(YES); // Or retu...

IPhone App: UIScrollView scrolls to bottom when it loads

I have a detail view for a contact. The last field is a Textview that can be as short as 1 line and as long as 20. in the viewDidLoad method I use: scrollView.contentSize = self.view.frame.size; My problem is that when the data is displayed, the scroll view scrolls to the bottom on its own. Obviously I would like it to start at the to...

Lazy loading in Objective-C -- too lazy?

I have a UIViewController that needs to set a few labels when it receives a new (object) value for one of its properties: -(void)setCurrentEvent:(Event *)e { [currentEvent release]; currentEvent = [e retain]; self.dateLabel.text = currentEvent.subtitle; self.summaryTextView.text = currentEvent.summary; self.avgRating...

Iphone: UIWebView inserting images from database

Hi Im trying to fetch an image from a blob field in a database and trying to insert into a UIWebView. thus far the code is -(void)prepareHTML{ imageBlob = [fp fetchImage:storyRowID]; //*****fetches the image blob data. returns an NSData* if([imageBlob length] <= 0){//****if there is no image data fetch it from the url and update row ...

iPhone SDK Try Catch exception handling

Hi all, I am writing a simple iPhone application and I am wondering if there is something equivalent to C#'s try{}-catch{}-finally{} exception handling. I have come across a few references via google, but I am having trouble figuring out what the actual syntax is on the iPhone platform. Does anyone know of a very basic example on ho...

How do I tell which cell in a UITableView?

How do I see which cell is selected in a UITableView? I'm just trying to do something simple, but I kinda forgot how to do it. :D Anyway, could some one help me? I want it to be an "if" statement such as: if (/*The first cell got selected*/) { self.label.text = @"Hello!" } Could someone fill out the commented space? Thanks ...

Targets, Xcode and interface files.

I have two apps which share a lot of source, so I want to put them into one Xcode project and use Targets to build them seperately. Some of the source files have the same name in both projects (for example, MapViewController.h and MapViewController.m). I thought as an intermediate step, I'd just put the whole classes folder into the merg...

iphone open photos app programmatically

hi is it possible to launch the "Photos" application out of an iphone app? Similar to launching mail? [[UIApplication sharedApplication] openURL:url]; ...

kqueue NOTE_EXIT doesn't work

Hi everybody. I am trying to use Apple's example of using kqueue but the callback is never called unless I start observing the kqueue after the process starts. But the lifetime of the process is short and i need the code to work if the process starts before or after I start observing it. ...

dataWithContentsOfURL return value not nil when URL empty

Hi everybody, i have a problem using dataWithContentsOfURL. I'm loading some images from the internet in a loop. The Problem is: if the image at the URL doesn't exist, dataWithContentsOfURL does NOT return nil as expected. The apple reference says it returns nil if NSData could not be created. Here's the Code: NSString *TermineImgFile...

Advice on setting up objective c program - fundamentals

Hi, I've been learning objective-C via a book and tutorials and while I've learned a lot and can do much of what I want, I still struggle to get the basic structure of my programs correct. Here's a specific thing I want to do, but I end up getting lost and confused. I want to generate a card object that (I think) should be a subclass o...