objective-c

Using NSSet/NSMutableSet to Filter Objects?

I have seen some questions/answers regarding filter objects by using NSSet/NSMutableSet. Those cases use simple type of objects such as NSString or int. The following is an example of codes used to filter NSString objects: NSSet smallArray = [[NSSet alloc] initWithObjects:@"0", @"1", @"2", nil]; NSArray bigArray = [[NSArray alloc] initW...

iPhone app crashes when comparing cell.textlabel.text to a string

This is a little side project I'm working on for fun. I begin by initializing with - (void)viewDidLoad { [super viewDidLoad]; rootArray = [[NSMutableArray alloc] initWithObjects:@"Earth",@"Mars",@"Pluto",nil]; moonArray = [[NSMutableArray alloc] initWithObjects:@"Clavius",@"Galileo",@"Ptolamy",nil]; marsArray = [[NSMutableArray al...

Objective C - Static and global variable ???

In my .m file for a class named Ad , I have 3 static strings static NSSTring *AdStateDisabled = @"disable"; static NSSTring *AdStateExpired = @"expired"; static NSSTring *AdStateActive = @"active"; I can simply use these static variables in the current class, but i cannot call them from any other class, is there a way to make these st...

problem with the writing TCP socket in objective c (error message)

Hi, i'm have problem with the writing TCP socket in objective c. i'm having the following error when i then to write a string to my server. some help please? error writing to stream <__NSCFOutputStream: 0x102009f0>: Error Domain=NSPOSIXErrorDomain Code=9 " the following are my code. Thanks inn advance - (void)setup { host = // ...

How to compile/include unrarsrc in an objective-c project?

I'm trying to replicate the unrar functionality in this project: http://github.com/tarasis/QuietUnrar But having trouble. I have copied the relevant files (/libunrar/,QuietUnrarAppDelegate.) into my project so I can turn QuietUnrarAppDelegate into a more generalised Unrar class, and immediately I run into problems. All the source files...

displaying textfields and labels dynamically on choosing from pickerview

i have pickerview with 2 components.when i select an item from both components some textfield and label should be displayed.this should happen for every combination.can anyone provide me the solution to this..actually im new to objective c thanks.. ...

Different encoding results when using writeToFile:atomically:encoding:error: vs. createFileAtPath:contents:attributes:

Hi there, In my iPhone App I have the capability to export data to an .txt file and send it via Mail – but have currently problems regarding the encoding. To attach the file to mail I simply create a NSData instance from a NSString instance as followed: NSData *dataToExport = [[NSData alloc] initWithData:[myExportString dataUsingEncod...

Getting RSSIValue from IOBluetoothHostController

I'm trying to write a simple application that gathers the RSSIValue and displays it via NSLog, my code is as follows: #import <Foundation/Foundation.h> #import <Cocoa/Cocoa.h> #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> #import <IOBluetooth/objc/IOBluetoothDevice.h> #import <IOBluetooth/objc/IOBluetoothHostController.h> #imp...

NSManagedObjectContext CoreData device / simulator differences

Hi, I'm relatively new to iPhone dev and have been trying to build an application to understand how CoreData works. I'm trying to implement some functionality that will allow me to detect if anything has been persisted to store and if so - give the user the option to delete those objects. I wondered if there are timing issues that nee...

Should I release this NSString?

Guys: Please help. I have a utility class to return a NSString with encoding. Like this: /*Get a NSString with chinese encoding*/ +(NSString*) getGBKString:(void *)buffer { NSString* string = [[[NSString alloc] initWithBytes:buffer length:sizeof(buffer) encodin...

Does copy allocate the required memory ?

Hi, Here is an example taken from Apple iPhone SDK project: @interface EADSessionController : NSObject <EAAccessoryDelegate, NSStreamDelegate> { EAAccessory *_accessory; EASession *_session; NSString *_protocolString; NSMutableData *_writeData; NSMutableData *_readData; } ... // initialize the accessory with the ...

Sending messages to a thread?

I need to imlement in cocoa, a design that relies on multiple threads. I started at the CoreFoundation level - I created a CFMessagePort and attached it to the CFRunLoop, but it was very inconvenient as (unlike on other platforms) it needs to have a (systemwide) unique name, and CFMessagePortSendRequest does not process callbacks back t...

Problem with XML parsing on iPhone

When I receive data from web service my NSMutableData is filled with following XML: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;GetWeatherResponse xmln...

CoreData Relationships Clarification: How to effectively set an inverse relationship

I have a CoreData relationship set up as follows: (sorry, I'm new to stackoverflow so I have to draw it with ascii). Story (object) Attributes: creationDate, order, Relationships: sentences (one to many with Sentence) Sentence (object) Attributes: image, order, text Relationships: belongsTo (one to one with Story) Notes: t...

Adding Animation into a page on ScrollView

Hi, I have an animation (currently 30 different images repeating) and I wish to add it into a single page in a ScrollView (currently holding 7 pages). Can this be done? I've added my code below, the behaviour I'm getting is that on my selected page nothing appears, on all the other pages I get the images as normal, but there must be som...

mapkit , tagging a disclosure button with index of annotation

i have been struggling with this for a few days, i even re-wrote half the code to try it another way. i have my annotations imported from a csv, and placed onto the map with tile and subtitle, i am trying in vain to add a tag to disclosue buttons so i can see which one was tapped, but having problems, whatever values i assign to the an...

Moving through JSON data in iPhone app

Hi all I'm afraid I'm a newbie to objective-c programming, and I am having a problem that I have spent all day trying to figure out and I cannot, so I am humbly asking you guys if anyone can help. I am trying to read the details from a JSON page online (for instance a local services directory) and have installed the JSON library into X...

Rotation Transformation for UITextField, but text is displaced

I am trying to rotate UITextField at 90 angle.It is rotationg perfectly..but text inside the UITextField, is displaced.I am unable to find out the reason behind it. ...

NSMutableArray EXC_BAD_ACCESS when i try read from it

I want update position of Particles for store this information I use NSMutableArray. I want do update 1 time per 2 seconds for example. For this I try use this code. //ParticlesLayer.h @interface ParticlesLayer : CCLayer { CCQuadParticleSystem *particle; NSMutableArray *partilesCoordinates; } @property (assign, readwrite) NSMutableArra...

What is the standard/best way of route implementation on iPhone?

Hi, I have read about a number of posts for developers who want to plot out a route on a map on an iPhone but there is no satisfactory answer as how to best achieve this. You can use the Route-Me library, add a layer on top MKMapView or send coordinates to phones map software then you navigate from your application, which in my opinion i...