How can I read and write ints from/to NSStreams? I know I can read bytes individually, but I want to take endianness into account. Java has DataStreams for these cases, is there something equivalent in Obj-C?
...
I have a method where I do some startup animations. The method gets called many times during usage of the app, but on it's first call it needs to do some special things in addition.
Are Singletons the way to go? Maybe there is also an better way, instead of measuring how many times this method was called, and storing that in an ivar.
...
I am trying to model an n-to-n relationship in Objective-C. Suppose I have two entities: Movie and Theater. A Movie has an array of Theaters and a Theater has an array of Movies. How do I do this in Objective-C to 1) get the relationship correct and 2) make sure memory is managed correctly.
...
I've searched far and wide for its meaning. My guess is that I somehow have a corrupt stack. I get
tiny _ free_ list_ add_ ptr
on the 16th call of the line that says:
NSDateFormatter *theFormatter = [[NSDateFormatter alloc] init];
What is the cause of the problem? Am I correct in thinking that I have a corrupt stack?
- (NSStr...
An iPhone question for you guys! I have an NSURLConnection that downloads XML from a server and processes it into an array which is a part of another array. I have no way of knowing how many objects I will need, so I cannot allocate an NSArray beforehand. My question is:
Would it be better to create the parent array as an NSArray at the...
I have a line of UILabel text in a UIView which is regularly updated via NSTimer. This code is supposed to write a status item near the bottom of the screen every so often. The data comes from outside of its control.
My app runs out of memory really fast because it seems the UILabel is not being released. It seems that dealloc is never ...
The iphone supports a means of defining your application's settings such that it will automatically create a UI in the Settings app. I want to also allow the user to edit the application settings within the application but it'd be nice to reuse the same UI that is automatically created.
See: Application Settings
Is there a way to have ...
I want to update uitextview from another uiviewcontroller classes.
Can anyone help me?
Thanks in advance..
...
I have two UIViewcontroller classes named First and second...When i clicked firstview button,i passed one string to secondview and display that string into secondview uitextview...But when i go to secondview there is no text in the textview...
I posted code....
What i am missing here
//first.h
#import <UIKit/UIKit.h>
@interface Firs...
HI....
How can i get route in the form of file or xml/kml/json format ??
Means I want to fond all the latitude and longitude between two location and i want to draw path on map.
path i can draw but i am not able to get all the latitude and longitude so can any body help me???
...
I'm trying to grope my way through Obj-C to build an iPhone game.
I'd like to build an array of objects for later use. Here's what I tried:
NSMutableArray *positionIcons;
[positionIcons insertObject:annotation atIndex:0];
positionIcons = [NSArray arrayWithObjects:annotation, nil];
The insertObject line leaves the count at 0. Howe...
I've observed similar behavior in an Apple example app and a game I am working on. In the game, the behavior is eventually causing the app to crash due to running out of memory. The example app is Touches.
At any point when touches are being tracked, which is when you're moving one of the objects around in Touches, and pretty much any t...
I have an AVAudioPlayer,let's call it player1, that starts in a particular UIViewController, let's call it myController1. I set numberOfLoops to -1 so the audio loops indefinitely. I set up a protocol so that myController1 acts as delegate for the AVAudioPlayer, so that I can trigger audioPlayerDidFinishPlaying. I also wrote a routine t...
I need to test whether the object is of type NSString or UIImageView. How can I accomplish this? Is there some type of "isoftype" method?
...
Hi,
I've got the following code:
#define checkLiteMessage \
{ \
#ifdef LITE_VERSION \
if (alertView.tag == 100) \
{ \
if (buttonIndex == 1) \
[ [UIApplication sharedApplication] openURL: buyAppLink]; \
[alertView release]; \
return; \
} \
#endif \
} \
What I want to do is to have the fol...
I'm running an app on the iPhone that performs the following action:
+ (void)performWrite:(NSData *)data {
[data retain];
[data writeToFile:@"WriteTest.tst" atomically:YES];
[[NSFileManager defaultManager] removeItemAtPath:@"WriteTest.tst" error:NULL];
[data release];
}
When running in Instruments, however, I see a lea...
I'm fairly new to Objective-C and I can't figure out how to wait in a non-blocking manner. I have an object that is being populated asynchronously and I need to wait on it before I can proceed in another method. Right now I am using the sleep function, but this blocks the whole app and myObject never gets loaded.
while (!myObject)
{
...
I'm compiling a .mm file (Objective-C++) for an iPhone application, and the precompiled header fails to include the base classes.
I tracked it down to the following:
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
Turns out, __OBJC__ is undefined for mm files, whereas it is defined for standar...
I want to fetch objects B which has a to-many relationship with object A (ie. A -->> B). I already have A in memory. I know I could get a NSSet of the B objects from A, but would it be better to make a fetch request of the B objects (especially if I want to sort sections by date in a UITableView)?
How would I make such a request that on...
I have logger.h file with static logger class. Then I want to add log messages to into each method invocation to trace app execution.
In order to do that I have to include logger.h into almost each Xcode .m project file. Is there any way to tell Xcode to automatically import logger.h into each project's .m file.
thx
...