I'm trying to follow a tutorial for a C++ interface in the Mac OS X API (Audio Queue Services), but in a Cocoa (well, actually just Foundation) application (well, actually just a 'tool'). It has a struct that looks like this:
static const int kNumberBuffers = 3; // 1
struct AQPlayerState {
AudioStreamBas...
In Apple's documentation for their example of a Singleton, and I do understand there's more than one way to skin a cat -- but why do they bother ensuring the instance is registered as static?
Take from: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html
I'm referring to:
...
Can some one explain to me the difference between categories and inheritance in Objective C? I've read the entry in wikipedia and the discussion on categories there doesn't look any different to that of inheritance. I also looked at the discussion on the topic in the book "Open Iphone Development" and I still don't get it.
I might be mi...
Hi.
I would like to write applications that use C++ and the Cocoa frameworks because Apple are not making Carbon 64-bit capable. C++ seems to be pretty vanilla in it's implementation on Linux and Windows but on Mac OS X it seems like additional Apple specific pieces of code are required (like an Obj-C wrapper). It also seems that Apple a...
I'm learning objective-c, working through Aaron Hillegass' book "Cocoa Programming for Mac OS X - Third Edition". I'm working in Xcode to develop some of the example code, and keep getting a compiler warning on the last line of this method:
- (void) setEntryDate:(NSCalendarDate *) date {
[date retain];
[entryDate release];
e...
Hi, I am new to coding and trying to get up to speed with Objective-C.
Came across some code I did not understand. I was hoping someone could
clarify it for me. In the case below, I am not sure how *foo2 is working and why it is not being released?
ClassOne *pointer = [[ClassOne alloc]init];
ClassTwo *foo = [[ClassTwo alloc]init], *fo...
I am getting a EXC_BAD_ACCESS (SIGBUS) on this line in my iPhone project:
if (timeoutTimer) [timeoutTimer invalidate];
The thing that has me stumped is that I don't understand how that line could crash, since the if statement is meant to be checking for nil. Am I misunderstanding the way Objective-C works, or do line numbers in crash ...
I would like to learn Objective-C using online tutorials. I'm a native C# programmer but I know C++. Which compiler should I use on windows vista?
...
HI all,
What is difference betwin self.myVariable = obj and myVariable = obj, when i use @propery/@synthesize for it
...
I would like to be able to check the type of an object
...
Hi There,
When debugging the following code
NSString *var1 = @"blaa";
NSString *var2 = @"blaaaaa";
NSString* script = [NSString stringWithFormat:@"Set_Variable( %s, %s )",var1,var2];
the %s placehoders in script are replaced with funny gibberish characters.
Can you see any errors in the code.
Many thanks,
(Confused .NET developer tr...
Hello. I am new to Objective C and Cocoa. I just don't get it how to message the superview of an UIView. I can't get it work. Here is what i tried so far:
In my MainView i have a method named resetDrawType:
- (void) resetDrawType {
self.drawType = foo;
}
Also in the MainView i create a subview and add it to MainView:
mySubView *m...
Do I have a leak with this statement?
//Pass the copy onto the child controller
self.childController.theFoodFacilityCopy = [self.theFoodFacility copy];
My property is set to:
@property (nonatomic, retain) FoodFacility *theFoodFacilityCopy;
The reason I think I have a leak is because copy retains the value and then my dot syntax prop...
I'm developing a Cocoa app, and I'm using constant NSStrings as ways to store key names for my preferences. I understand this is a good idea because it allows easy changing of keys if necessary. Plus, it's the whole 'separate your data from your logic' notion. Anyway, is there a good way to make these constants defined once for the whole...
Hi,
I'm new to Objective-C and I saw the "new type" BOOL (YES, NO).
I read that this type is almost like a char.
For testing I did :
NSLog(@"Size of BOOL %d", sizeof(BOOL));
NSLog(@"Size of bool %d", sizeof(bool));
Good to see that both logs display "1" (sometimes in C++ bool is an int and its sizeof is 4)
So I was just wondering ...
Used the MyGizmoClass example in a iPhone app where I have an object that sets and maintain db info.
How do I eliminate the
'MyGizmoClass' may not respond to '+sharedManager'
Warning
The offending line of code is:
NSString *databasePath = [[MyGizmoClass sharedManager]databasePath];
...
I'm new to Cocoa/Cocoa Touch, and working through a development book. I've come across situations where the @selector() operator is used. I'm a bit lost on how and when the @selector() operator should be used. Can someone provide a short and sweet explanation and example of why it's used and what benefit it gives the developer?
By th...
I'm in the process of learning Objective-c but would like to run code snippets via some sort of emulator on Windows — preferably web based.
I want to understand Objective-C syntax and walk through common code examples, probably via some sort of console. I would probably leave any framework type learning for when I get onto my MacBook,...
I know the basic principles about memory management (retain count, autorelease pools etc) in Cocoa, but once you go past simple retain/release, it's getting a bit more confusing. I couldn't find decent answers for those, as most tutorials cover simple scenarios. I would like to ask about best practices in how to write the code and avoid ...
-(id)init {
if (self = [super init]) {
self.name = [[NSString alloc] init];
self.type = [[NSString alloc] init];
self.phoneNumber = [[NSString alloc]init];
self.webAddress = [[NSString alloc] init];
NSMutableArray *pricesArray = [[NSMutableArray alloc] init];
NSMutableArray *poolsArray = [[NSMutableArray alloc] init];
self.pric...