[IPhone SDK] NSTimer conflicts with touch events

Hi all,
i've an NSTimer that refresh the UIView at 30 fps. Below there is the scheduled timer:
animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(refreshAll) userInfo:nil repeats:YES];
The problem is that the app doesn't wrap the touch events (touchbegan, touchesMoved and touchEnded) because the timer interval is too low and conflicts with this events.
I tried to set the animation interval to 2 seconds and the touch events works but the rendering obviously is slow.
However the problem is only on the device because when i launch the app on the simulator i have no problem with the timer.
Can anyone tell me how I can solve this problem?
Thanks

The game I'm developing for the iPhone has 2 play modes (the second mode has more on screen objects). In the first game mode, I get a solid 29-30 frames per second (acceptable), however the second mode with more objects gives me 25 fps (slightly jerky). BTW, on a PC with modern hardware I get >1300 fps @1680x1050.
At first I thought that the NSTimer resolution might be causing problems. The Apple demos all use a resolution of 1/60. Setting a value of 0.0 actually bumps the frame rate up by few frames, but I lose the ability to process touch input (crap). Adding usleep(a_delta) hoping to invode a context switch does nothing for the touch input.
The next thing I tried was creating a dedicated rendering thread which basically does a while (1) render(); The thread will loop as fast as it can, and I regain touch input. On the plus side, I gained 3-4 fps for both game modes, so now I can hit 30 fps for the second mode (sweet).
To make this work, I obviously needed to add locking primitives between the render thread and the iphone input (touch, sleep, phone call etc). The render loop is now basically:
while (alive)
aLock->Lock();
render();
aLock->Unlock();
Anyway, I thought people would appretiate my experience when looking to squeeze a few more frames out of the iPhone. You just need to understand multiprocessing to work out the synchronisation issues.
PS. There is some interesting advice in the following thread:
http://discussions.apple.com/thread.jspa?messageID=7898898&#7898898
Basically, they set invoke the runloop from the animation method. This might be simpler than spawning threads and handling locking, but I haven't tried it.

Similar Messages

  • IPhone SDK - trouble working with iPod Touch 2G

    Hello, new Macbook OSX 10.5.4, new iPod Touch running iPhone OS 2.1. Just downloaded and installed xcode 3.1.1 and newest iPhone SDK.
    I read the iPhone OS Pre-Installation Advisory document found here:
    http://developer.apple.com/iphone/download.action?path=/iphone/iphoneos_software_preinstallation_advisory/iphone_os_2.1_preinstallationadvisory.pdf
    I created shortcut:
    .../iPhoneOS.platform/DeviceSupport/2.1.1/
    pointed to:
    .../iPhoneOS.platform/DeviceSupport/2.1/
    Checked the shortcut, it works.
    Start xcode, open Window->Orgnizer. "Xcode cannot find the software image to install this version" is showing up just below the "Software Version" line. Software version has a value of 2.1.1 (5F138).
    If I ignore this and continue to build, sign and try the application. I will receive an error message "Your mobile device has encountered an unexpected error (0xE800003A) during the install phase: Verifying application" I tried disconnect the iPod Touch, power off, power on. Same problem.
    I tried to make a complete copy in (not a shortcut):
    .../iPhoneOS.platform/DeviceSupport/2.1.1/
    Same problem.
    What should I do to trace this issue?

    I wanted to compile and upload the sample app Accelerometer Graph onto my brand new ipod touch 16.
    I got the notorious error (0xE800003A) during the install phase, verifying.
    i checked all the product id#'s which i just copied/pasted when creating the certificates etc.... so i don't know what's wrong... so what IS wrong?
    here's the logs:
    ==== Attached at 2008-09-25 17:04:27 -0400 ====
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: urn IOSDIOController::enumerateSlot(UInt8, bool): Found SDIO I/O device. Function count(2), memory(0)
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: IOReturn IOSDIOIoCardDevice::parseCIS(): Device manufacturer Id(4d50), Product Id(4d48)
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325::init(): Starting with debug level: 4, debug flags: 00000000
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325::start()
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325::initHardware(): BCM4325 revision D0
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: read new style signature 0x43313131 (line:281)
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: [FTL:MSG] VSVFL Register [OK]
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: [FTL:MSG] VFL Init [OK]
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: detected HBPP. driver will be kept alive
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: enabled power, scheduled bootloading
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: BCM4325 Firmware Version: wl0: Sep 1 2008 14:42:30 version 4.173.4.0
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325::initFirmware(): successful initialization
    Thu Sep 25 17:04:17 unknown com.apple.launchd[1] <Notice>: Bug: launchd.c:228 (23506):19: mount("fdesc", "/dev", MNT_UNION, NULL) != -1
    Thu Sep 25 17:04:18 unknown com.apple.launchctl.System[2] <Notice>: Bug: launchctl.c:2907 (23614):2: sysctl(nbmib, 2, &nb, &nbsz, NULL, 0) == 0
    Thu Sep 25 17:04:18 unknown com.apple.launchctl.System[2] <Notice>: /dev/disk0s1 on / (hfs, local, read-only, noatime)
    Thu Sep 25 17:04:18 unknown com.apple.launchctl.System[2] <Notice>: /dev/disk0s2 on /private/var (hfs, local, nodev, nosuid, noatime)
    Thu Sep 25 17:04:18 unknown com.apple.launchctl.System[2] <Notice>: launchctl: Couldn't stat("/etc/mach_init.d"): No such file or directory
    Thu Sep 25 17:04:19 unknown com.apple.launchd[1] <Warning>: open("/var/logs/BTServer/stdout", ...): No such file or directory
    Thu Sep 25 17:04:19 unknown com.apple.launchd[1] <Warning>: open("/var/logs/BTServer/stderr", ...): No such file or directory
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325: Ethernet address 00:22:41:c3:88:2c
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleBCM4325::setPowerStateGated() : Powering On
    Thu Sep 25 17:04:19 unknown mDNSResponder mDNSResponder-178.2 (Aug 10 2008 22:56:13)[17] <Error>: starting
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: downloaded 128 bytes of prox calibration data ("built-in")
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: downloaded 256 bytes of calibration data ("built-in")
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleD1759PMUPowerSource: AppleUSBCableDetect 1
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleSynopsysOTG2::handleUSBCableConnect cable connected, but don't have device configuration yet
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleMultitouchZ2SPI: downloaded 48612 bytes of firmware data ("0x0051.bin") in 149ms.
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: AppleS5L8720XFMSS::_fmssInitCmdsAndCEMaskCtrl: VendorSpecific: VSCMDSIMPLE
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: [FTL:MSG] VFL_Open [OK]
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: [FTL:MSG] YAFTL Register [OK]
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: [FTL:MSG] FTL_Open [OK]
    Thu Sep 25 17:04:19 unknown /usr/sbin/fairplayd[20] <Notice>: Vroum
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: Got boot device = IOService:/AppleARMPE/arm-io/AppleS5L8720XIO/flash-controller0@A00000/AppleS5L8 720XFMSS/disk@FF/AppleNANDFTL/IOFlashBlockDevice/IOBlockStorageDriver/unknown vendor unknown product Media/IOFDiskPartitionScheme/Untitled 1@1
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: BSD root: disk0s1, major 14, minor 1
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: Jettisoning kernel linker.
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: mDNSResponder[17] syscallbuiltinprofile: mDNSResponder (seatbelt)
    Thu Sep 25 17:04:19 unknown kernel[0] <Debug>: mDNSResponder[17] Builtin profile: mDNSResponder (seatbelt)
    Thu Sep 25 17:04:20 unknown com.apple.BTServer[26] <Notice>: BTServer 1.2 () Modified on
    Thu Sep 25 17:04:20 unknown com.apple.BTServer[26] <Notice>: com.apple.server.bluetooth: Bluetooth Super Server Robot Destroyer
    Thu Sep 25 17:04:20 unknown com.apple.BTServer[26] <Notice>: com.apple.server.bluetooth: Got local-mac-address: 00:22:41:c1:42:29
    Thu Sep 25 17:04:20 unknown com.apple.BTServer[26] <Notice>: machport is com.apple.server.bluetooth
    Thu Sep 25 17:04:20 unknown lockdownd[15] <Error>: (0x3941d6d0) lookupimei: Could not get matching service for baseband
    Thu Sep 25 17:04:21 unknown mDNSResponder[17] <Error>: Note: SetDomainSecrets: no keychain support
    Thu Sep 25 17:04:21 unknown com.apple.BTServer[26] <Notice>: Cannot read termcap database;
    Thu Sep 25 17:04:21 unknown com.apple.BTServer[26] <Notice>: using dumb terminal settings.
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: Opening /dev/cu.bluetooth @ 115200 baud.
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: bluetooth wake is now ON
    Thu Sep 25 17:04:22 unknown com.apple.itunesstored[18] <Notice>: Couldn't open shared capabilities memory GSCapabilities (No such file or directory)
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: bluetooth reset was pulsed 100 ms
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: Issued HCI Reset
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: Sending UpdateUART_BaudRate
    Thu Sep 25 17:04:22 unknown com.apple.BTServer[26] <Notice>: Setting local baud rate
    Thu Sep 25 17:04:23 unknown configd[21] <Notice>: CLTM: No thermal sensors detected, not registering for notifications
    Thu Sep 25 17:04:24 unknown kernel[0] <Debug>: en0: setting diversity to: -1
    Thu Sep 25 17:04:24 unknown lockbot[30] <Error>: copy_preference: Could not ssetgid to 501: Operation not permitted
    Thu Sep 25 17:04:24 unknown kernel[0] <Debug>: en0: setting tx antenna: -1
    Thu Sep 25 17:04:24 unknown lockbot[31] <Error>: copy_preference: Could not ssetgid to 501: Operation not permitted
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) sanitizedevicename: Could not convert device name into buffer
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80cc00) calculateapplicationusage: Calculating the application usage
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) ping_configd: Could not sanitize device name
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) load_systemversion: Could not lookup release type
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) extract_recordidentifier: Could not extract ICCID from account token
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) loadactivationrecords: Could not extract ICCID from record
    Thu Sep 25 17:04:24 unknown lockdownd[15] <Error>: (0x80be00) loadactivationrecords: This is the iPod activation record
    Thu Sep 25 17:04:24 unknown configd[21] <Notice>: setting hostname to "iPod"
    Thu Sep 25 17:04:25 unknown lockdownd[15] <Error>: (0x80be00) determineactivationstate: The original activation state is Activated
    Thu Sep 25 17:04:25 unknown lockdownd[15] <Error>: (0x80be00) determineactivationstate: SIM status: kCTSIMSupportSIMStatusReady
    Thu Sep 25 17:04:25 unknown lockdownd[15] <Error>: (0x80be00) determineactivationstate: The activation state has not changed.
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 - Configuration: PTP
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 Interface: PTP
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 - Configuration: iPod USB Interface
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 Interface: USBAudioControl
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 Interface: USBAudioStreaming
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 Interface: IapOverUsbHid
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 - Configuration: PTP + Apple Mobile Device
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2 Interface: AppleUSBMux
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction Register function USBAudioControl
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: IOAccessoryPortUSB::start
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction Register function IapOverUsbHid
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: virtual bool AppleUSBDeviceMux::start(IOService*) build: Aug 10 2008 22:34:20
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: init_waste
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction Register function USBAudioStreaming
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction Register function AppleUSBMux
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction Register function PTP
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::gated_registerFunction all functions registered- we are ready to start usb stack
    Thu Sep 25 17:04:26 unknown kernel[0] <Debug>: AppleSynopsysOTG2::handleUSBReset
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Current Device: UART - /dev/cu.bluetooth
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Setting speed to 115200
    Thu Sep 25 17:04:26 unknown /usr/libexec/ptpd[12] <Notice>: PTP interface bas been activated at high speed.
    Thu Sep 25 17:04:26 unknown SpringBoard[22] <Warning>: Not monitoring for AOS notifications since they are not enabled by user defaults.
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Sending UpdateUART_BaudRate
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Setting local baud rate
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Using env variable: BTDEVICEADDRESS = 00:22:41:c1:42:29
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Sending WriteBDADDR
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Using host name: iPod
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Sending WriteLocalName: iPod
    Thu Sep 25 17:04:26 unknown com.apple.BTServer[26] <Notice>: Sending SetSleepmodeParam
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: com.apple.server.bluetooth: Server attached, going into msg loop.
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: Cannot read termcap database;
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: using dumb terminal settings.
    Thu Sep 25 17:04:27 unknown afcd[35] <Error>: user mobile has uid 501
    Thu Sep 25 17:04:27 unknown afcd[35] <Error>: mode is 0x41e8
    Thu Sep 25 17:04:27 unknown configd[21] <Notice>: WiFi: Currently not associated. Beginning auto join sequence.
    Thu Sep 25 17:04:27 unknown configd[21] <Notice>: WiFi: External power source attached
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: Opening /dev/cu.bluetooth @ 2400000 baud.
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: bluetooth wake is now ON
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: Issued HCI Reset
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: Sending SetSleepmodeParam
    Thu Sep 25 17:04:27 unknown com.apple.BTServer[26] <Notice>: bluetooth wake is now OFF
    Thu Sep 25 17:04:28 unknown lockdownd[15] <Error>: (0x81c200) set_timezone: Setting the time zone to /usr/share/zoneinfo/US/Eastern
    Thu Sep 25 17:04:28 unknown com.apple.mediaserverd[16] <Notice>: mediaserverd: 17:04:28.136 StreamUSBAspen.cpp[163]: GetCurrentPhysicalFormat(): ERROR: No HAL stream format corresponding to the current iAP digital audio sample rate 0 Hz
    Thu Sep 25 17:04:32 unknown itunesstored[18] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x10c620>. posting local notification for distributed notification: com.apple.itunes-mobdev.syncWillStart
    Thu Sep 25 17:04:32 unknown iapd[19] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x20b290>. posting local notification for distributed notification: com.apple.itunes-mobdev.syncWillStart
    Thu Sep 25 17:04:32 unknown afcd[56] <Error>: user mobile has uid 501
    Thu Sep 25 17:04:32 unknown afcd[56] <Error>: mode is 0x41e8
    Thu Sep 25 17:04:34 unknown SpringBoard[22] <Warning>: lockdown says the device is: [Activated], state is 3
    Thu Sep 25 17:04:34 unknown /System/Library/CoreServices/SpringBoard.app/SpringBoard[22] <Notice>: CLTM: initial thermal level is 0
    Thu Sep 25 17:04:35 unknown securityd[32] <Error>: misagent[60] SecItemCopyMatching: missing entitlement
    Thu Sep 25 17:04:36 unknown SpringBoard[22] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x232830>. posting local notification for distributed notification: com.apple.itunes-mobdev.syncWillStart
    Thu Sep 25 17:04:36 unknown SpringBoard[22] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x232830>. auto-generating notification 'com.apple.itunes-mobdev.syncWillStart' for (
    <SBSyncController: 0x2ad960>
    Thu Sep 25 17:04:36 unknown itunesstored[18] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x10c620>. posting local notification for distributed notification: com.apple.springboard.syncingUnblocked
    Thu Sep 25 17:04:36 unknown iapd[19] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x20b290>. posting local notification for distributed notification: com.apple.springboard.syncingUnblocked
    Thu Sep 25 17:04:37 unknown SpringBoard[22] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x232830>. posting local notification for distributed notification: com.apple.springboard.syncingUnblocked
    Thu Sep 25 17:04:37 unknown SpringBoard[22] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x232830>. auto-generating notification 'com.apple.itunes-mobdev.syncWillStart' for (
    <ABRingtoneManager: 0x2c5660>,
    <SBVODController: 0x2c5d70>
    Thu Sep 25 17:04:37 unknown SpringBoard[22] <Warning>: INFO:: ITSyncHelper <ITSyncHelper: 0x232830>. posting local notification for distributed notification: com.apple.itunes-mobdev.syncWillStart
    Thu Sep 25 17:04:37 unknown securityd[32] <Error>: mobileimagemou[54] SecItemCopyMatching: missing entitlement

  • (iPhone SDK 7) UIScrollView subview touch problem

    New here, in fact new to the SDK but getting on well with it (plenty of previous coding experience to draw on). However, I've been hitting my head against a brick wall with UIScrollView and it making subviews, e.g. UIImageViews, no longer be touchable. When I move the image views outside the scroll view it's fine, so I know they're working and the touchesBegan:withEvent is processing as it should do.
    Here's what I'm doing in the initWithFrame:
    scroller = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,400)];
    scroller.scrollEnabled = YES;
    CGSize sz;
    sz.width = 320;
    sz.height = 800;
    scroller.contentSize = sz;
    scroller.tag = 400;
    scroller.userInteractionEnabled = YES;
    scroller.delaysContentTouches = YES;
    scroller.canCancelContentTouches = NO;
    [self addSubview:scroller];
    (I've tried all different combinations of delaysContentTouches and canCancelContentTouches just to see if they made a difference, originally I hadn't got either in there. But they don't seem to alter anything)
    And then the image views:
    buttonPlay = [[UIImageView alloc] initWithFrame:CGRectMake(20,320,40,40)];
    buttonPlay.image = [UIImage imageNamed:@"blah.jpg"];
    buttonPlay.userInteractionEnabled = YES;
    buttonPlay.tag = 100;
    [scroller addSubview:buttonPlay];
    buttonSettings = [[UIImageView alloc] initWithFrame:CGRectMake(80,320,40,40)];
    buttonSettings.image = [UIImage imageNamed:@"blah.jpg"];
    buttonSettings.userInteractionEnabled = YES;
    buttonSettings.tag = 101;
    [scroller addSubview:buttonSettings];
    Basically no touch events are being generated anywhere I click within the scroll view and I'm at a loss to work out why.
    Not sure if it's related either but I can't get a UILabel to respond to a touch either, even though I've enabled userInteractionEnabled for it - even trying a simple project I can't get a UILabel to generate a touch event at all.
    Any help on the above scroll view issue would be appreciated as it's driving me nuts!
    Cheers

    UIScrollView must not pass these events up the responder chain. I'm not sure if this is intended behavior, but it seems like it might be (if so the docs should be updated). I took my test code and verified:
    1. scroller's nextResponder points the UIView of the ViewController.
    2. That UIView has a nextResponder pointing to the ViewController
    This is what you would expect from the docs on the UIResponder Chain. However, it relies on each UIView subclass to pass the event up the responder chain +if it isn't handled fully+. UIScrollView must be making the assumption that "the buck stops here". Hence your touchesBegan: in your viewController never gets the message.
    Further, a little more testing with this at the end of viewDidLoad:
    BOOL status1 = [scroller canResignFirstResponder];
    BOOL status2 = [scroller resignFirstResponder];
    BOOL status3 = [self.view becomeFirstResponder];
    showed me:
    status1 = NO
    status2 = NO
    status3 = NO
    I'd say UIScrollView likes the power it wields .

  • Win SDK function conflict with CVI library function

    I do not have  SDK_CONFLICT_PRIORITY defined.  Is this new to CVI 2009?
    The following code gives me an error  "11, 58   Too many arguments to `CVI_WriteFile'."
    #include <windows.h> 
    #include <formatio.h>  
    void function (void) {
        HANDLE hHandle = INVALID_HANDLE_VALUE;
        char buffer [1000] = {'\0'};
        DWORD dwWriteCount;
      if (!WriteFile (hHandle, buffer, 5, &dwWriteCount, NULL)) {
    I have included  <windows.h>   before   <formatio.h>  but CVI still wants to use the formatio version of WriteFile - it appears to have been renamed   CVI_WriteFile  ?!?!?
    If I eliminate the #include <formatio.h>  it compiles OK.
    Message Edited by menchar on 03-06-2010 04:00 PM

    Well, the complete source for formatio.h I reported before is this one:
    #ifdef _NI_mswin32_
    extern int CVIFUNC      cviprefix(CloseFile)(int handle);
    extern int CVIFUNC      cviprefix(OpenFile)(const char *filename,int rd_wrt, int action, int bin_ascii);
    extern int CVIFUNC      cviprefix(ReadFile)(int handle, char *buf, int count);
    extern int CVIFUNC      cviprefix(WriteFile)(int handle, const char *buf, int count);
    extern int CVIFUNC      cviprefix(SetCommitMode)(int commit);
    #define CloseFile       cviprefix(CloseFile)
    #define OpenFile        cviprefix(OpenFile)
    #define ReadFile        cviprefix(ReadFile)
    #define WriteFile       cviprefix(WriteFile)
    #define SetCommitMode   cviprefix(SetCommitMode)
    #else
    In the header this warning is present:
    /* This header must be included after any Windows SDK header or any header */
    /* that directly or indirectly includes a Windows SDK header.              */
    /* Some of the function names conflict with Windows SDK functions.         */
    As far as I can understand (but I'm not an expert on these very technical and tricky aspects of C) first of all CVI functions are renamed CVI_xxx, after it a call to WriteFile or any other function in that group is defined to be translated to CVI_WriteFile, so when you call WriteFile the preprocessor actually translates it in the CVI version of the function and SDK one is superseded.
    My understandment is that if you undefine WriteFile, you can actually use both functions if you want: native CVI one by calling CVI_WriteFile and SDK one by simply calling WriteFile.
    ...or I can be missing some other hint, which can surely be possible!
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • IPhone SDK - Linking error with CLLocationManager

    Hello.
    I have a linking error when I try to use thr CLLocationManager in my iPhone application by using the example of source code given in the Developer Center.
    I have the following error : ".objcclass_nameCLLocationManager", referenced from literal-pointer@_OBJC@__clsrefs@CLLocationManager in localisation.o
    symbol(s) not found.
    Do you have an idea ?
    Thank you for your answer.
    Patrick Schevenels.

    Just for clarification, there's a flood of developers now purchasing Macs to code for the iPhone platform. For those of you new to Xcode, you add a framework by doing the following:
    1. Open your iPhone project in XCode
    2. In the project window, ctrl+click (or right-click if you have 2-button mouse) on 'Frameworks' folder > Add > Existing Frameworks
    3. Navigate to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Li brary/Frameworks/CoreLocation.framework
    4. Click 'Add' button
    5. Compile
    Also, for anyone coming for the ActionScript Java or C# world, I've been blogging on transitioning to iPhone OS development platform.
    http://www.digitalassassin.com/?p=15
    Message was edited by: P120D1GY

  • IPhone sdk: sync sound with animations

    Hi,
    I am sure this is a very basic question. I would appreciate if someone can point me to the right directions.
    I want to play a sound (say a song) and then perform an animation based on the beat of the sound. I guess it would be similar to creating visualizations that many media players have.
    I would speculate I need to get notifications from the playback when sound pattern detects a beat and then drive animation absed on these events.
    What classes/samples should I be looking for?
    Thanks

    Be sure to plug the iPhone into a USB port on the computer, preferably in the back of the Mac Pro, and not to an external hub or keyboard port.
    See this Apple support article and the contained links:
    http://support.apple.com/kb/TS1591

  • [iPhone SDK] Trial App with Activation Key?

    Hi,
    Is there a concept of 'Trial' in these iPhone Apps? Ideally I'd like Trial functionality for my app but then allow users to buy the Full app from AppStore.
    How would I go about doing this? Or will I need to develop two apps, one trial and one full? Thanks

    Seems like a no brainer, for sure. But you can't right now.
    Best bet is to link to a QuickTime video. I've seen some people with a free/paid version as well in the Store.
    I don't think Apple quite understands this business, but hopefully they will catch on.

  • IPhone SDK: DrawRect NSString with font characteristics

    Can I do
    #define font (GSFontRef)GSFontCreateWithName("Arial", 2, 14.0f) or #define font [ NSClassFromString(@"WebFontCache") createFontWithFamily:@"Arial" traits:2 size:14.] inside of SDK?
    So that I can draw my NSString in Arial, bold, 14pt. in my UIView's drawRect.
    [self.text drawInRect:rect withFont:font lineBreakMode:l alignment:a];

    I don't know the source of your problem but maybe you could draw the background color yourself.
    - (void) drawRect:(CGRect)aRect
    fill frame with color
    [super drawRect:aRect];
    draw your lines
    You may have to tell the cell or tableview to use clearColor for it's background so that it doesn't obscure your drawing.

  • IPhone SDK 6 : Bug with VIew controller Autorotation ?

    Since i installed the Beta 6, the views that used to work fine now dont size properly after the orientation has been changed. For e.g. when i change the orientation the size of the view changes to 560 x 240. It should have been 480 x 320.
    I should note here that i am not using the IB. I code my views and view controllers.
    Am i missing something? Has anyone noticed a similar behavior?
    Thanks.
    -TRS

    The issue is with UINavigationController navigationBarHidden property being set to YES. The view sizes properly after rotation if this property is set to NO which is the default.
    This issue may be fixed in Beta 7 but i have not had a chance to verify it. Will test and post my results here.
    I have filed a bug after an apple engineer at WWDC confirmed it is a bug.
    -TRS

  • [iphone SDK] Managing dictionary with setting.bundle

    Hi,
    Quick question : Is there a way of managing Arrays / Dictionaries in the setting application, using the setting.bundle file ? (Purpose is to have the same result than "mail", when handling a variable number of accounts. )
    Or will I have to develop it myself ?
    Regards.
    Cyril

    Andreas,
    I think you responded to the wrong thread.
    Oops, nevermind, didn't see the width comment up there and can't delete my post.
    Message was edited by: ShawnKC

  • Apple TV & iPhone/iPod download conflicts

    So, I love both my Apple TV and my iPhone but they conflict with one another in terms of downloads. I don't have enough video yet to fill my entire Apple TV so I tell iTunes to send all of the video I do have to the Apple TV. HOWEVER, when I go to synch my iPhone I need to uncheck most movies and TV shows that I do have because I can't fit all that content on the iPhone.
    Doesn't seem like a big deal right? Unfortunately, it is because it seems the Apple TV always wants to sync whenever there is a change. So, it goes ahead and deletes all my video from its hard drive shortly after the iPhone syncing.
    I wish there was a checkbox on the Apple TV summary page that would allow me to tell iTunes to only Sync Apple TV when I initiate the sync. There isn't though so I'm looking for some advice.
    Anyone?

    Was going to say the same thing. For the iPhone (I too have iPhone and AppleTV) I don't take the default options for syncing. I just made a playlist named iPhone and I put in it all the music I want on the iPhone. I then tell the iPhone to only sync to that playlist (not have to worry about checks and all then). Same for movies on the iPhone. When I sync I know what I want on it so I don't accept the default try to do all, but rather just set to pick right there in the iPhone Movies (or is it video) tab. Really not a big deal at all.

  • HT204587 Do I still need to swipe to open with Touch ID security?

    Do I still need to swipe my iPhone to open it with Touch ID security? It seems like when I first activated my phone this morning, I didn't need to swipe, but now one of my settings must have been changed inadvertantly and even after I utilize the Touch ID, I need to swipe to open my phone.

    http://www.apple.com/feedback

  • Can Touch Events and Swipe Events exist in the same frame and/or movie?

    After having fully tested a file with touch events I decided to add both a touch event and swipe event to a frame.
    I started by importing the following statements:
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    I then added th appropriate code but only touch events worked. I fiddled so more and only the gesture events worked. So before I move any further, I'm wondering if I'm wasting my time trying to get them to work together.
    So my questions are:
    Can Touch Events and Swipe Events exist together in the same frame?
    Can Touch Events and Swipe Events exist scene?
    A reference to more information about this would be helpful, if you know of any.

    I am aware of the latest releases of the components along with the plug-ins.
    This note is applicable to your scenario but you might face some issues related to organization rule wizard, custom user group creation and EAM DB log collection, as mentioned at the bottom of the note. No matter on what SP level you are with GRCFND_A at 10.1, you would face these issues.
    And so far, i don't think there is any more update from SAP on co-existence of plugins of 5.3 and 10.1
    Ameet

  • [iPhone SDK] NSIndexPath from Row number?

    Getting a 'cell' from a row index was certainly possible with the open iphone SDK. However with the iPhone SDK, I can't seem to get a Cell with a mere Row Index. I guess the closest I need is a NSIndexPath from a row index but there seems to be no such way.
    Either that or I manually construct a NSIndexPath. Is that possible?

    If you've created a table that has only a single section, then according to the documentation
    [NSIndexPath indexPathForRow: rownumber inSection: 0]
    will do it.
    I hadn't come across this until I was answering this question, so I've been using
    {NSUInteger indexes[2]={0,rownumber};
    NSIndexPath * indexPath=[NSIndexPath indexPathWithIndexes:indexes length:2];
    and this definitely works.

  • IPhone SDK with iPod Touch 2G problem

    I installed the SDK last night but when I went to plug in my iPod Touch 2G, I got the error message: 'Unable to locate a suitable developer disk image. Please re-install the SDK'
    I have reinstalled the SDK many times but still get the same error message. Any help appreciated.
    Thanks

    {quote}He's talking about the iPod Touch, not a regular iPod{quote}
    Yep, I know. Do a Google search for "Unable to locate a suitable developer disk image". Found this on the comments of [this blog post|http://www.tbradford.org/2008/03/iphone-sdk-beta-2-possible-ppc-fix.html]:
    {quote}
    If anyone else runs into the "Unable to locate a suitable developer disk image." problem, there's a package called "DeveloperDiskImage" in the iPhone SDK that needs to be installed.
    As of 2.1, these are the extra packages that you need to install manually:
    iPhoneSDKHeadersAndLibs
    iPhoneSimulatorPlatform
    iPhoneHostSideTools
    iPhoneDocumentation
    DeveloperDiskImage
    {quote}
    Another [blog post|http://khakionion.blogspot.com/2008/09/iphone-sdk-21-doesnt-include-ipod-t ouch.html#links] says:
    {quote}
    The problem is that the huuuuuge iPhone SDK 2.1 installer doesn't come with the iPod touch 2.1 firmware image. Suck. Fear not, though: All you have to do is force iTunes to do a firmware restore, which will download the appropriate image. On next launch, Xcode will find it and everything will work great.
    {quote}

Maybe you are looking for