I have an application for the iPhone that does not depend on UIKit in any way (it is not related to UIKit). This means that I do not use UIApplication and therefore do not call UIApplicationMain .
The problem is that when I create a timer, it never fires. The timer is created as follows:
[NSTimer timerWithTimeInterval:10 target:self selector:@selector(updateTime) userInfo:nil repeats:TRUE];
I suspect that the problem may be related to the cycle loop, since after completing the main initialization in " main () " I do this:
NSLog(@"Starting application ...");
applicationInstance = [MyApp alloc];
[applicationInstance setMainLayer:mainLayer];
[NSThread detachNewThreadSelector:@selector(runApplication) toTarget:applicationInstance withObject:nil];
CFRunLoopRun();
I turned my attention to UIKit and noticed that UIApplication does a lot more, like logging for system events, etc. NSTimer can rely on one of these things. Another thing I noticed is that in the UIApplication delegate, the stream is the same as in main ().
How do I get NSTimer to work correctly? If this is related to the loop cycle, can someone point out an error? " CFRunLoopRun () " is used to hang the main thread so that the rest of the application can work. I do not think this is true.
Edit: I think the loop cycle should be configured. Somehow ...