Do synthesized instance variables work in iPhone SDK?

I tried using Obj-C properties to synthesize not only the accessor methods, but also the instance variable. I ended up with an error saying something like "...must explicitly name an ivar...".
I was under the impression the iPhone ran the modern (64-bit) Objective-C runtime. I'm using xCode 3.x and iPhone SDK 2.2. Are synthesized instance variables not supported, or do I need to change some xCode/project configuration settings to activate this support (I'd really like to use it)?
Does the fact that I'm linking to the Sen Test Kit Framework, or running on a relatively old Intel MacBook Pro cause this problem? If the 2.2 SDK does not support synthesized instance variables, does iPhone SDK 3.0 beta support them?
Note that I would need the synthesized ivar support to work on the iPhone simulator too (obviously) so that I can do testing. Hopefully the iPhone simulator supports the modern Obj-C 2.0 runtime.
Thank You,
Eric

orangekay wrote:
A. I don't see that anywhere in the Objective-C 2.0 language specification, so I don't believe this has anything to do with the iPhone SDK.
B. I don't see any point in adding such a thing to the language as it accomplishes nothing that could not be handled with a standard ivar declaration.
This sounds like a feature you imagined.
Yeah, right I imagined it. Get a clue, will you?
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/oc Properties.html#//apple_ref/doc/uid/TP30001163-CH17-SW3
In general the behavior of properties is identical on all runtimes (see Runtime Versions and Platforms in Objective-C 2.0 Runtime Programming Guide). There is one key difference: the modern runtime supports instance variable synthesis whereas the legacy runtime does not.
For @synthesize to work in the legacy runtime, you must either provide an instance variable with the same name and compatible type of the property or specify another existing instance variable in the @synthesize statement. With the modern runtime, if you do not provide an instance variable, the compiler adds one for you. For example, given the following class declaration and implementation:
@interface MyClass : NSObject {
float sameName;
float otherName;
@property float sameName;
@property float differentName;
@property float noDeclaredIvar;
@end
@implementation MyClass
@synthesize sameName;
@synthesize differentName=otherName;
@synthesize noDeclaredIvar;
@end
the compiler for the legacy runtime would generate an error at @synthesize noDeclaredIvar; whereas the compiler for the modern runtime would add an instance variable to represent noDeclaredIvar.

Similar Messages

  • Which version of iPhone SDK is available for MAC OS 10.3.9

    Hi,
    I want to develop an application for iPhone using my MAC OS 10.3.9 version.
    Which version of iPhone SDK is available for MAC OS 10.3.9?
    Can I install and work with iPhone SDK 6 or 7 version on MAC OS 10.3.9.
    Regards,
    Punit

    but the installation steps of SDK says that it can be installed on MAC OS 9.3.x also by customizing it during installation for the MAC OS 9.3.x.
    If possible, could you post a link to where this information is.
    OS 9 does not have a version 9.3.x so I am not sure what you are referring to unless that was a typo and you meant 10.3.x?
    I think you might get better support in the Developer forum. If you don't receive any other response here in this topic perhaps posting there might attract more knowledgable SDK users.
    littleshoulders
    Message was edited by: littleshoulders
    Message was edited by: littleshoulders

  • 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

  • Learning iPhone SDK - Trying to draw an image

    Although I have programmed for Mac in the last years, I have never used Mac-specific technologies as Cocoa (I have programmed more in OpenGL, SDL, and the like).
    Now I am getting started with the iPhone SDK. I'd like to do some OpenGL|ES stuff, but since it is not supported in the Simulator, and you need to join the Developer Program to test stuff on directly on the device (and admission of new members is closed right now), I am focused on other stuff right now, like using Core Graphics for drawing images on the iPhone.
    My application is based on the Cocoa Touch Application template. I left the default code except for a few changes.
    In file "UntitledAppDelegate.m", I have changed the method applicationDidFinishLaunching to:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
    [window addSubview:contentView];
    [window makeKeyAndVisible];
    Then, in the MyView interface file (MyView.h), I have added the attribute "UIImageView* image;" to the class, which is declared as a property, and synthesized.
    In the class implementation (MyView.m), I have changed the method initWithFrame to:
    - (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
    self.backgroundColor = [UIColor darkGrayColor];
    image = [self loadImageView:@"box01.png"];
    [self addSubview:image];
    return self;
    loadImageView is a private method I have implemented as:
    - (UIImageView *)loadImageView:(NSString *) imageName {
    UIImage *img = [UIImage imageNamed:imageName];
    UIImageView *theView = [[UIImageView alloc] initWithImage:img];
    return theView;
    Since I have loaded the UIImage, and initialized a UIImageView with it, and the image view is added as a subview of the main view attached to the window, I thought it should be everything needed to draw an image on the screen. But nothing is visible. The screen is simply black when I run this on the Simulator. It doesn't even set the background to dark gray.
    So I need some help with this, I sure that anyone with experience in Mac programming will know how to help me.
    Thank you in advance.
    Message was edited by: Jedive

    I removed the XIB file from the project, but that didn't help. It was a problem with my inexperience with Objective-C. When accessing class properties in a method of the same class, i was not putting "self." before the property (in C++ that's redundant). For example, in the line "window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];". After adding it, it works correctly.

  • Binding: Instance variable loses value.

    Hi all,
    Just making my first steps into Objective-C, I've done a lot of C, C++ and C# on win & linux. Anyhow, I've been hacking away happily and discovered a peculiar behaviour, and I'm not sure if it's my code or some obscure bug in Xcode.
    1. I have a Check Box(NSButton) directly bound to a BOOL instance variable called "checkValue" using KVC. The containing class is a custom NSView subclass.
    2. I manually implemented the setter according to KVC naming rules "setCheckValue".
    3. When debugging the UI (check box) calls the setter perfectly with the correct value, which shows up in the NSLog output.
    4. I hooked up the action for the check box as well, and inside the action handler the instance variable reports the value correctly. Everything looks fine.
    5. Now here's the rub. I put a mousedown event handler into the class as well, and it is called flawlessly when I click on the custom view. However, "checkValue" does not report the correctly set value.
    So, how can a class instance variable, which is set and reports correctly elsewhere in the same scope, all of the sudden take on a nonsense value in a event handler? If a variable has a value set, it should be the same everywhere within the same scope!
    Below is simplified code extracted from the original project for clarity. It produces exactly the same behaviour as the more complex project without the distracting code.
    #import "CheckBoxHandler.h"
    @implementation CheckBoxHandler
    @synthesize checkValue;
    //Apparently this is required for binding in NSView based classes
    //The same behaviour occurs even if you remove this.
    +(void)initialize
    [self exposeBinding:@"checkValue"];
    -(id)initWithFrame:(NSRect)frameRect
    self = [super initWithFrame:frameRect];
    if(!self)
    return nil;
    [self setCheckValue:YES];
    return self;
    //manual impelementation of KVC setter
    -(void)setCheckValue:(BOOL)v
    checkValue = v;
    NSLog(@"Setter Called: checkValue is %d", checkValue);
    //The action works fine as evidenced by Log output
    //Check and uncheck the box a few times.
    -(IBAction)checkBoxAction:(id)sender
    NSLog(@"UI State:%d Ivar State: %d", [checkBox state], checkValue);
    //Mouse clicking on the view calls into this event.
    //The problem is the value reported by [self checkValue] OR checkValue directly
    //do not match the UI state. In fact it always reports some nonsense value.
    -(void)mouseDown:(NSEvent *)event
    NSLog(@"Inside Mousedown: checkValue is: %d", [self checkValue]);
    @end
    I have a workaround, but it really bends my head when something doesn't behave as expected!

    I have synthesized against "checkValue", although I manually implemented the setter so I could set a breakpoint and observe the value. I thought [self checkValue] and self.checkValue both simply call the same getter, just different syntax.
    The setting of the value using the UI checkbox happens outside of the event call chain. I can check and uncheck the checkbox and the value changes correctly. The checkbox is in a separate space on the window, so clicking it does not activate mousedown on the view, this is correct behaviour. Clicking on the view does activate the mousedown event, this is done after I've set the checkbox so the value has been set well before the mousedown event. Thus it should already have the correct value in the event.
    For completeness this is the interface file:
    #import <Cocoa/Cocoa.h>
    @interface CheckBoxHandler : NSView {
    IBOutlet NSButton *checkBox;
    BOOL checkValue;
    -(IBAction)checkBoxAction:(id)sender;
    @property (assign, readwrite) BOOL checkValue;
    @end
    I'll change everything to self.checkValue just for the excercise. Ok, done. checkValue still reports a value of 1 in the mousedown event regardless of the value set elsewhere.

  • How to control the movie player in iPhone SDK 2.0?

    Hello, everybody!
    With the third beta version of iPhone SDK I finally played a movie with the example from the manual. But I need to seek in the movie and control the playing process. With the MPMoviePlayerController class this is impossible, because it has four properties (backgroundColor, contentURL, scalingMode, userCanShowTransportControls) and only three instance methods (initWithContentURL, play, stop). The notifications are two (MPMoviePlayerScalingModeDidChangeNotification, MPMoviePlayerPlaybackDidFinishNotification). How can I know what is the current position of the head and how can I change it? I can't find other classes, which can play a movie. Can somebody help me?
    Stefan

    HeoU wrote:
    Hi Tsvyatkov,
    Do you HAVE [these problems|http://discussions.apple.com/thread.jspa?threadID=1486343&tstart=0] while playing video playback?
    - The keyboard doesn't appear after playing the video (It works great before playing the video)
    - When you play the video, iphone simulator turns in paysage mode. Then when you stop it, it doesn't turn back (SDK beta 3). It worked fine with the SDK beta 1, 2.
    - If you chose a video from a list (UITableView) and you stop the video, then come back to the list, the item is still selected with the blue color.
    thanks
    HeoU
    Yes! I have the same problems! And with the older versions of iPhone SDK I didn't.

  • IPhone SDK: unrecognized selector

    I'm relatively new to Objective-C/iPhone SDK development. I have an issue that really seems to produce random (or at least nondeterministic) errors, all of which are "unrecognized selector" errors.
    I have a UITableViewController that is populated with table names from a MySQL database. When I select a table name, a second UITableViewController is created to display detailed data. I thought this was working just fine, but I discovered I have problems when I select a certain table name, (detailed results are displayed in second UITableViewController), go back, select the same table name, (...), go back, and select the same table name a third time. The Simulator explodes and gives me an error like:
    * -[UICGColor length]: unrecognized selector sent to instance 0x1050810
    Sometimes it's related to UICGColor, sometimes it's related to CALayerArray. Sometimes it doesn't produce any error at all and just terminates.
    What's also weird is that only some of the table names cause this to happen. Also, if I cycle through several table names (i.e., not select the same table over and over), the app is fine. I would tend to think that maybe something is wrong with my database or MySQL C API usage, but the fact that things are perfectly fine the first and second (and third and fourth and ... and nth for some tables) time baffles me. I'm not using any dynamic method calling either -- just straight
    [ object method: ] syntax, so I'm not sure how it suddenly can "lose" the selector reference that it was perfectly happy to use earlier. As far as I can tell, I'm releasing memory as necessary.
    Any clues why this seems to be so weird and unpredictable? I can provide source if it would help.

    Ugh. Problem solved. I was tampering with autorelease, and it got me into trouble. I had this:
    query = [ [ [ NSString alloc ] initWithFormat:@"...%@", [ [ tableView cellForRowAtIndexPath:indexPath ] text ] ] autorelease ];
    I thought that I should autorelease the "anonymous" object I created. It made sense at the time, but upon thinking about retain/release more closely, it's so clear now.

  • Xcode debugger not showing my instance variables!!

    I hate asking questions like this.
    I set a breakpoint in an IBAction method 'pushed:' inside FooViewController.  At runtime I pressed a GUI button and processing stopped in pushed:.
    In the data-viewing pane of xcode, I see
    {code}
    self = (FooViewController *) 0x... etc.
    {code}
    Indented under this is
    {code}
    UIViewController = (UIViewController) { ...
    {code}
    Nowhere do I see any of my instance variables!!
    Now, they were synthesized from properties, but that doesn't matter, does it?
    The code that proceeds to set some instance variables runs fine.
    Why isn't xcode displaying self's instance vars?
    Thanks,
    Chap

    Yes, yours looks like I was expecting mine to look.
    Note that viewDidLoad (below) does work correctly, producing the expected results in the simulator!
    Hangman3ViewController.h:
    @interface Hangman3ViewController : UIViewController {
    @property (         nonatomic )           NSInteger  wordLength;
    @property ( retain, nonatomic )           NSString  *alphabet;
    @property (         nonatomic )           unichar    guess;
    @property (         nonatomic )           NSInteger  guessNo;
    @property ( retain, nonatomic )           NSMutableString *board;
    @property ( retain, nonatomic ) IBOutlet  UILabel   *boardLabel;
    @property ( retain, nonatomic ) IBOutlet  UILabel   *guessNumberLabel;
    @property ( retain, nonatomic ) IBOutlet  NSArray   *keyboardButtons;
    - (IBAction)letter:(id)sender;
    - (void)showBoard;
    @end
    and, Hangman3ViewController.m:
    #import "Hangman3ViewController.h"
    @implementation Hangman3ViewController
    @synthesize wordLength       = _wordLength;  // preprocessor command to gen getter/setter and instance variable
    @synthesize boardLabel       = _boardLabel;  // preprocessor command to gen getter/setter and instance variable
    @synthesize guessNumberLabel = _guessNumberLabel;  // Guess #n
    @synthesize keyboardButtons  = _keyboardButtons;   // array of buttons
    @synthesize alphabet         = _alphabet;    // A-Z unichars
    @synthesize guess            = _guess;       // unichar
    @synthesize guessNo          = _guessNo;     // int
    @synthesize board            = _board;
    - (IBAction)letter:(id)sender
                Get letter from sender - driven when key button is pressed.
                The button's tag is an int from 0-25, identifying what letter of the alphabet it is.
                Extract that unichar from ALPHABET as 'guess'.  Then, disable the button,
                which has been defined to have its text turn white (invisible) when disabled.
        UIButton *button = (UIButton *)sender;
        self.guess = [self.alphabet characterAtIndex: button.tag];
        NSLog(@"Received keystroke: %C", self.guess);
        [button setEnabled:NO];
    - (void)showBoard
        self.boardLabel.text = self.board;
        self.guessNumberLabel.text = [NSString stringWithFormat:@"Guess #%d", self.guessNo];
    - (void)dealloc
        [_boardLabel release];
        [_guessNumberLabel release];
        [_keyboardButtons release];
        [super dealloc];
    - (void)didReceiveMemoryWarning
        // Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
        // Release any cached data, images, etc that aren't in use.
    #pragma mark - View lifecycle
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad
        NSLog(@"Hello from viewDidLoad");
        [super viewDidLoad];
        self.alphabet   = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // unichar string
        self.wordLength = 7;  // temp - will be set from flipside later on
        self.guessNo    = 1;
        [self.board setString:@"_______"]; // actually dynamic based on wordLength
        self.board = @"_______";
        [self showBoard];
    - (void)viewDidUnload
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    @end

  • Parsing XML and Storing values in instance variable

    hi,
    i'm new to XML.
    here i'm trying to parse an XML and store their element data to the instance variable.
    in my main method i'm tried to print the instance variable. but it shows "" (ie it print nothing ).
    i know the reason, its becas of the the endElement() event generated and it invokes the characters() and assigns "" to the instance variable.
    my main perspective is to store the element data in instance variable.
    thanks in advance.
    praks
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    public class mysax extends DefaultHandler
         String ctelement;
         CharArrayWriter contents;
         String vname1,vrcbreg1,vaddress1,vcountry1,vtelephone1,vfax1;
         String vname,vrcbreg,vaddress,vcountry,vtelephone,vfax;
         public mysax()
              vname1 = null;
              vrcbreg1 = null;
              vaddress1 = null;
              vcountry1 = null;
              vtelephone1 = null;
              vfax1 = null;
              contents= new CharArrayWriter();
         public void doparse(String url) throws Exception
              SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser sp = spf.newSAXParser();
    ParserAdapter pa = new ParserAdapter(sp.getParser());
    pa.setContentHandler(this);
    pa.parse(url);          
         public void startElement(String namespace,String localName,String qName,Attributes atts)
              ctelement = localName;     
         public void endElement(String uri,String localName,String qName) throws SAXException
         public void characters(char[] ch,int start, int length) throws SAXException
              try
                   if(ctelement.equals("name"))
                        vname = new String (ch,start,length);
                        System.out.println("The method "+vname1);
              }catch (Exception e)
                   System.out.println("The exception "+e);
         public static void main(String args[])
              try
              mysax ms = new mysax();
              ms.doparse(args[0]);
              System.out.println("the contents name "+ms.vname1);
              catch(Exception e)
                   System.out.println("this is exception at main" +e);
    my XML looks like
    <coyprofile_result>
    <company>     
    <name>abcTech</name>
    <rcbreg>123456789</rcbreg>
    <address>Singapore</address>
    <country>sg</country>
    <telephone>123456</telephone>
    <fax>123155</fax>
    </company>
    </coyprofile_result>

    I believe that the problem has to do with the value you assign to ctelement. You are assigning the value of localName to ctElement, however for the element: <name>...</name> the localname is empty string i.e. "", but qName equals "name". Because you are assigning empty string to ctElement, when you do the comparison in characters of ctElement to "name" it will always be false. So in startElement change it to ctElement = qName; Try it and see if it works. I have produced similar programs and it works for me.
    Hope this helps.

  • Instance variable to hold the element of a tag in the xml file

    Hi I have an xml file that is handled using this parser
    <attr id="MY_NAME" >
    this parser hanled the above tag but now I want to have it handle
    <attr id="MY_NAME" desc="GOOD">
    but I need to create an instance variable to handle the desc element in the attr tag .
    Can some one help me out as this is not my file and I am having trouble to do please......
    import java.util.*;
    import java.io.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
       The SupportMatrix class provides static variables and methods to simplify
       the determination of whether or not a given attribute is supported for a
       certain object type (queue manager, channel, etc.), depending on the version
       and platform of the queue manager to which it belongs.
       The SupportMatrix class may not be instantiated. Its constructor is private.
       An instance of the class is created internally in the static initializer so
       that the XML parsing methods are available.
       A corresponding XML document, SupportMatrix.xml, is parsed to create the various
       HashMaps which contain the version/platform dependency information. A number of
       inner classes are used to represent the various elements of the XML matrix
       definition.
       Here's a sample document:
       <!-- The supportmatrix tag opens the document -->
       <supportmatrix>
         <!-- Objects are keyed by classid. "1" is the classid of a queue manager object. -->
         <object classid="1">
           <!-- Versions group attributes according to the queue manager version where they
                were introduced. The "base" cmdlevel encompasses all versions up to 5.1. -->
           <version cmdlevel="base">
             <!-- Attributes are defined by the attr tag. -->
             <attr id="MQCA_Q_MGR_NAME">
               <!-- Support elements define the platform-specific requirements for an attribute. -->
               <support platforms="UNIX,WINDOWS,OS400,VMS,NSK" maxlen="48" type="MQCFST"/>
               <support platforms="MVS" maxlen="4" type="MQCFST"/>
             </attr>
             <attr id="MQCA_Q_MGR_DESC">
               <!-- Specific attribute characteristics, most notably maximum len for string parms,
                    are defined in the support element. As shown in the following example, it may
                    apply to all platforms. -->
               <support platforms="all" maxlen="64" type="MQCFST"/>
             </attr>
             <!-- Support elements are optional. -->
             <attr id="MQIA_PLATFORM"/>
             <attr id="MQIA_COMMAND_LEVEL"/>
           </version>
           <!-- The version element may 'include' other versions. Note that object elements
                may also refer to other objects via the 'include' parm of the object tag.
                This is to allow common attributes (especially for queues and channels) to
                be shared by multiple definitions in order to reduce some of the
                redundancy. -->
           <version cmdlevel="520" include="base">
           </version>
         </object>
       </supportmatrix>
       The inner classes, and their hierarchical relationships are as follows:
         SupportObject - corresponds to the <object> element. Stored in a static HashMap, and
                         keyed by classid.
           VersionObject - corresponds to the <version> element. Stored in a HashMap instance
                           variable of the SupportObject class, keyed by cmdlevel.
             AttributeObject - corresponds to the <attr> element. Stored in a HashMap instance
                               variable of the VersionObject class, keyed by attribute name.
               PlatformObject - corresponds to the <support> element. Stored in HashMaps belonging
                                to the AttributeObjects, keyed by platform. A single PlatformObject
                                instance is created when the support tag is encountered. The
                                "platforms" attribute of the support element is then processed. For
                                each platform in the comma-delimited list, an entry is added to the
                                collection of PlatformObjects. This is to greatly simplify later
                                lookups.
       In order to support the 'include' feature of object and version elements, certain
       functions are recursive. If the attribute to be validated is not found for the passed
       cmdlevel, the 'parent' VersionObject is consulted by means of the 'include' value. If
       the chain of VersionObjects has been exhausted and the attribute in question has still not
       been located, the next SupportObject in the chain is consulted in a similar fashion.
    public class SupportMatrix extends DefaultHandler {
        /** The objects collection holds all the SupportObjects, keyed by classid. */
        private static HashMap objects;
        /** xmlFile will name the xml document to be parsed. Note that using the
            default class loader expects the string to be the path to the file. It must
            NOT begin with the '/' character. */
        private static String xmlFile =
            ResourceManager.getApplicationProperties().getProperty("SupportMatrixFile");
        private Stack stack;
        /** This static initializer allocates the static objects collection, creates an
            instance of the SupportMatrix class for xml parsing purposes, and initiates
            the parse operation to populate the collection. */
        static {
            objects = new HashMap();
            // Create a parser and process the xml doc
            SupportMatrix handler = new SupportMatrix();
            InputSource is = null;
            try {
                is = new InputSource(ClassLoader.getSystemClassLoader().getResourceAsStream(xmlFile));
                XMLReader xmlReader =
                    SAXParserFactory.newInstance().newSAXParser().getXMLReader();
                xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
                xmlReader.setContentHandler(handler);
                if (is == null) {
                    System.err.println("No input stream, dammit");
                xmlReader.parse(is);
            } catch(Exception e) {
                e.printStackTrace();
        /** Private constuctor, used only for XML parsing. */
        private SupportMatrix() {
            stack = new Stack();
        /** Add a SupportObject instance to the objects collection. */
        private void addObject(SupportObject obj) {
            String key = obj.getClassId();
            objects.put(key, obj);
        /* DefaultHandler methods                                              */
        /** Not used. */
        public void characters(char[] ch, int start, int length) {}
        /** Not used. */
        public void endDocument() {}
        /** For the version, object, and attr elements, pop the top element of the stack. */
        public void endElement(String uri, String localName, String qName) {
            if (localName.equals("version") || localName.equals("object") || localName.equals("attr")) {
                stack.pop();
        /** Not used. */
        public void setDocumentLocator(Locator locator) {}
        /** Not used. */
        public void startDocument() {}
        /** Most of the work is done here. Create the appropriate inner class instance for
            element; for object, version, and attr, push the element onto the stack so that
            child elements may be added to their collections as needed. */
        public void startElement(String uri, String localName, String qName,
                                 Attributes attributes) {
            String include = attributes.getValue("include");
            if (localName.equals("object")) {
                SupportObject obj = new SupportObject(attributes.getValue("classid"), include);
                addObject(obj);
                stack.push(obj);
            } else if ( localName.equals("version")) {
                VersionObject ver = new VersionObject(attributes.getValue("cmdlevel"), include);
                ((SupportObject)stack.peek()).addVersion(ver);
                stack.push(ver);
            } else if ( localName.equals("attr")) {
                AttributeObject a = new AttributeObject(attributes.getValue("id"));
                //String desc = StringFactory.getString(attributes.getValue("desc"));
                //if(desc != null)
                   //     a.setAttribute();
                String readonly = attributes.getValue("readonly");
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null) {
                    a.setCondition(include, true);
                if (exclude != null) {
                    a.setCondition(exclude, false);
                if (readonly != null)
                    a.setReadonly(readonly.equals("y"));
                ((VersionObject)stack.peek()).addAttr(a);
                stack.push(a);
            } else if (localName.equals("support")) {
                String platforms = attributes.getValue("platforms");
                String readonly = attributes.getValue("readonly");
                String maxlen = attributes.getValue("maxlen");
                String type = attributes.getValue("type");
                int attrType = 0;
                if (type != null) {
                    if (type.equals("MQCFIN")) {
                        attrType = CMQCFC.MQCFT_INTEGER;
                    } else if (type.equals("MQCFIL")) {
                        attrType = CMQCFC.MQCFT_INTEGER_LIST;
                    } else if (type.equals("MQCFST")) {
                        attrType = CMQCFC.MQCFT_STRING;
                    } else if (type.equals("MQCFSL")) {
                        attrType = CMQCFC.MQCFT_STRING_LIST;
                    } else if (type.equals("EXBIN")) {
                        attrType = MqcConstants.EXCFT_BINARY;
                    } else if (type.equals("EXPCF")) {
                        attrType = MqcConstants.EXCFT_PCF;
                PlatformObject p = null;
                if (readonly == null) {
                    p = new PlatformObject(platforms);
                } else {
                    p = new PlatformObject(platforms, readonly.equals("y"));
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null)
                    p.setCondition(include, true);
                if (exclude != null)
                    p.setCondition(exclude, false);
                if (attrType != 0)
                    p.setType(attrType);
                if (maxlen != null)
                    p.setLen(Integer.parseInt(maxlen));
                ((AttributeObject)stack.peek()).addPlatform(p);
        public static boolean isExported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, node);
        public static boolean isExported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return false;     // None of 'our' objects can be exported to MQSC.
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isExported(attribute, classId, cmdLevel, platform, node);
        public static boolean isExported(int attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, classId, cmdLevel, platform, node);
        /** Determine if an attribute is exportable. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the AttributeObject for the combination of attribute, classid, and
            command level. If we can't find the AttributeObject, we assume that the attribute
            is not exported. Otherwise, find out if it is exportable for the selected platform.
        public static boolean isExported(String attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            AttributeObject attr = getAttributeObject(attribute, classId, cmdLevel);
            if (attr == null) {
                return false;
            } else {
                return attr.isExported(platform, node);
        public static boolean isSupported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, node);
        public static boolean isSupported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return true;
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isSupported(attribute, classId, cmdLevel, platform);
        public static boolean isSupported(int attribute, String classId, String cmdLevel, String platform) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, classId, cmdLevel, platform);
        /** Determine if an attribute is supported. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the SupportObject for the classid. If it isn't there, we make the assumption
            (for now) that the attribute is supported. The only classids for which this can occur are
            broker, agent, and the various container objects.
            Propagate the isSupported request to the chain of SupportObjects (based on 'include' values)
            until we get a 'true' result or we run out of SupportObjects. */
        public static boolean isSupported(String attribute, String classId, String cmdLevel, String platform) {
            if (attribute == null)
                return false;
            SupportObject obj = (SupportObject)objects.get(classId);
            // If the object type isn't even in the support matrix, we interpret that to
            // mean that it's a Broker or Agent, in which case all attributes are supported
            // at present.
            if (obj == null)
                return true;
            boolean result = false;
            while (result == false && obj != null) {
                result = obj.isSupported(attribute, cmdLevel, platform);
                if (result == false && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Locate an AttributeObject for a given attribute name, object type, and command level.
            This is a helper function for the getMaxLen and getType methods. */
        private static AttributeObject getAttributeObject(String attr, String classID, String cmdLevel) {
            AttributeObject result = null;
            SupportObject obj = (SupportObject)objects.get(classID);
            while (result == null && obj != null) {
                result = obj.getAttr(attr, cmdLevel);
                if (result == null && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Determine the maximum length for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getMaxLen(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getMaxLen(platform);
        /** Determine the PCF parm type for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getType(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getType(platform);
        /** Inner class to contain platform-specific info for an attribute. */
        class PlatformObject {
            /** This instance variable will contain the comma-delimited string of all
                platforms to which this object applies. */
            private String platform;
            private int maxlen;
            private String condition = null;
            private boolean include;
            private boolean readonly;
            private boolean lenSet;
            private int attrType;
            private boolean typeSet;
            public PlatformObject(String p, boolean readonly) {
                platform = p;
                this.readonly = readonly;
                lenSet = false;
                typeSet = false;
            public PlatformObject(String p) {
                this(p, false);
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public boolean isReadonly() {
                return readonly;
            public boolean isExported(TopologyModelNode node) {
                if (condition != null) {
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                    } catch (Exception e) {}
                    if (include ^ test)
                        return false;
                return !readonly;
            public void setLen(int len) {
                maxlen = len;
                lenSet = true;
            public void setType(int type) {
                attrType = type;
                typeSet = true;
            public String getPlatform() {
                return platform;
            public int getMaxLen() {
                if (!lenSet)
                    return -1;
                return maxlen;
            public int getType() {
                if (!typeSet)
                    return -1;
                return attrType;
        /** This class represents a specific MQSeries attribute. It can optionally contain
            instances of the PlatformObject class as needed. When the 'platforms' collection
            is empty, the attribute is supported on all platforms. It is also possible to
            include a PlatformObject for the 'all' platform, if specific attribute characteristics
            need representation. When the 'platforms' collection is non-empty, it will include one
            entry for each platform where the attribute is supported. */
        class AttributeObject {
            private String attribute;
            private String attrValue;
            private HashMap platforms;
            private String condition = null;
            private boolean include;
            private boolean readonly = false;
            public AttributeObject(String a) {
                this(a, false);
            public AttributeObject(String a, boolean readonly) {
                attribute = a;
                platforms = new HashMap();
                this.readonly = readonly;
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public void setReadonly(boolean readonly) {
                this.readonly = readonly;
            public boolean isReadonly() {
                return readonly;
            public void addPlatform(PlatformObject p) {
                for (StringTokenizer st = new StringTokenizer(p.getPlatform(), ","); st.hasMoreTokens() ;) {
                    platforms.put(st.nextToken(), p);
            public PlatformObject getPlatform(String platform) {
                PlatformObject p = (PlatformObject)platforms.get(platform);
                if (p == null)
                    p = (PlatformObject)platforms.get("all");
                return p;
            public String getAttribute() {
                return attribute;
            public int getMaxLen(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getMaxLen();
            public int getType(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getType();
            public boolean isSupported(String platform) {
                if (platforms.isEmpty()) {
                    return true;
                if (platforms.containsKey(platform)) {
                    return true;
                if (platforms.containsKey("all")) {
                    return true;
                return false;
            public boolean isExported(String platform, TopologyModelNode node) {
                if (readonly) {
                    Log.log(Log.DEBUG, this, attribute + " is readonly, returning false");
                    return false;
                if (condition != null) {
                    Log.log(Log.DEBUG, this, "Testing condition = " + condition);
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                        Log.log(Log.DEBUG, this, "Condition result is " + test);
                    } catch (Exception e) {
                        Log.log(Log.ERROR, this, "Condition through an exception");
                    if (include ^ test)
                        return false;
                if (platforms.isEmpty()) {
                    return true;
                PlatformObject p = getPlatform(platform);
                if (p == null) {
                    Log.log(Log.DEBUG, this, platform + " not found for " + attribute + ", returning false");
                    return false;
                return p.isExported(node);
        /** This class represents a specific value of a queue manager's command level. A
            given instance of this class may 'include' a 'parent' instance through its
            include instance variable. The traversal of the parent/child hierarchy is
            delegated to the SupportObject class, since that is where the collection of
            VersionObjects lives. */
        class VersionObject {
            private String cmdLevel;
            private String include;
            private HashMap attributes;
            public VersionObject(String cmdLevel, String include) {
                this.cmdLevel = cmdLevel;
                this.include = include;
                attributes = new HashMap();
            public void addAttr(AttributeObject attr) {
                attributes.put(attr.getAttribute(), attr);
            public AttributeObject getAttr(String attr) {
                return (AttributeObject)attributes.get(attr);
            public String getCmdLevel() {
                return cmdLevel;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String platform) {
                AttributeObject obj = (AttributeObject)attributes.get(attr);
                if (obj == null) {
                    return false;
                } else
                    return obj.isSupported(platform);
        /** This class represents an MQSeries object type, as identified by its classid, e.g.
            queue manager or local queue. This class implements an include facility similar to
            that described for the VersionObject. The traversal of that hierarchy is delegated
            to the static isSupported method, because the collection of SupportObject instances
            is a static variable of the SupportMatrix class. */
        class SupportObject {
            private String classId;
            private String include;
            private HashMap versions;
            public SupportObject(String classId, String include) {
                this.classId = classId;
                this.include = include;
                versions = new HashMap();
            public void addVersion(VersionObject obj) {
                String key = obj.getCmdLevel();
                versions.put(key, obj);
            public String getClassId() {
                return classId;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String cmdLevel, String platform) {
                boolean result = false;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return false;
                while (result ==  false && obj != null) {
                    result = obj.isSupported(attr, platform);
                    if (result == false && obj.getInclude() != null) {
                        obj = (VersionObject)versions.get(obj.getInclude());
                    } else
                        obj = null;
                return result;
            public AttributeObject getAttr(String attr, String cmdLevel) {
                AttributeObject result = null;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return null;
                while (result ==  null && obj != null) {
                    result = obj.getAttr(attr);
                    if (result == null && obj.getInclude() != null)
                        obj = (VersionObject)versions.get(obj.getInclude());
                    else
                        obj = null;
                return result;
    }

    Are you the one who commented out the code you're looking for ?//String desc = StringFactory.getString(attributes.getValue("desc"));You just have to modify you AttributeObject class to hold a new field : String description. And then, it's up to you to create a new constructor or a new setter method.
    Btw, this is not a Swing related question.

  • Null Instance Variables on Screenflow

    Hi,
    I have some problems with instance variable of type BPM Objects in a Screenflow.
    I always create automatic processes without user interaction, and on server side I have seen that it's not necessary to instantiate an instance variable. Moreover if within a method I write (I use the Java style syntax):
    String a;
    a.toString(); // just to call a method on a not-instantiated variable
    everything works correctly, the "a" variable is automatically instantiated.
    But it seems that in an automatic activity of a Screenflow it's different, I need to do the new also for Instance Variables.
    Then, in the Screenflow I have an Instance Variable myObject of type MyObject that is a BPM Object. This object has an attribute myStrings that is an array of String.
    To instantiate the instance variable I can write:
    myObject = new MyObject();
    But then I get a java.lang.*NullPointerException* when I call the extend method of its attribute myStrings to add a string.
    Do you agree with me that on the Screenflow code it's necessary to instantiate the variables?
    How can I instantiate an Array of String?
    Thank you.

    Thanks Daniel, I'm using ALBPM 6.0,
    i know the line where I get the exception, I have a logMessage before and after each line of code, and then in the exception stack there is the PBL Method line indicated:
    Caused by: java.lang.NullPointerException
         at xobject.Fuego__AutoGen__Screenflows__.__ScreenflowConJsp.automatic1(__ScreenflowConJsp.xcdl:*19*)
    19 is the code line where I get the exception. In this line I have this:
    myObject.myStrings.extend(arg1 : a);
    but the null object is not the array, it's myObject that is an Instance Variable.
    In ALBPM60_Studio_ReferenceGuide at chapter Programming Styles paragraph Java Programming Style there is:
    This style emulates Java syntax and adds several features to match PBL expressions. These added features include:
    • Output arguments
    • Input and display statements
    • Variable auto-initialization
    In fact in my previuos BPM projects I have seen that is not necessary to istantiate the variables, both for Instance Variable and local variable declared within a method. In my previous post I did an example:
    String a;
    a.toString();
    Usually this causes an Exception, but not in ALBPM methods.
    My main question is: is it possible that this is true just for Server side methods and not for Screenflow methods? Because in my case I need to instantiate every Instance Variable of my Screenflow (for example the myObject instance variable) in an Automatic Activity I have put as first Activity of the flow.
    Thanks again for your help.

  • Binding a JavaFX variable to a Java class instance variable

    Hi,
    I am pretty new to JavaFX but have been developing in Java for many years. I am trying to develop a JavaFX webservice client. What I am doing is creating a basic scene that displays the data values that I am polling with a Java class that extends Thread. The Java class is reading temperature and voltage from a remote server and storing the response in an instance variable. I would like to bind a JavaFx variable to the Java class instance variable so that I can display the values whenever they change.
    var conn: WebserviceConnection; // Java class that extends Thread
    var response: WebserviceResponse;
    try {
    conn = new WebserviceConnection("some_url");
    conn.start();
    Thread.sleep(10000);
    } catch (e:Exception) {
    e.printStackTrace();
    def bindTemp = bind conn.getResponse().getTemperature();
    def bindVolt = bind conn.getResponse().getVoltage();
    The WebserviceConnection class is opening a socket connection and reading some data in a separate thread. A regular socket connection is used because the server is not using HTTP.
    When I run the application, the bindTemp and bindVolt are not updated whenever new data values are received.
    Am I missing something with how bind works? Can I do what I want to do with 'bind'. I basically want to run a separate thread to retrieve data and want my UI to be updated when the data changes.
    Is there a better way to do this than the way I am trying to do it?
    Thanks for any help in advance.
    -Richard

    Hi,
    If you don't want to constantly poll for value change, you can use the observer design pattern, but you need to modify the classes that serve the values to javafx.
    Heres a simple example:
    The Thread which updates a value in every second:
    // TimeServer.java
    public class TimeServer extends Thread {
        private boolean interrupted = false;
        public ValueObject valueObject = new ValueObject();
        @Override
        public void run() {
            while (!interrupted) {
                try {
                    valueObject.setValue(Long.toString(System.currentTimeMillis()));
                    sleep(1000);
                } catch (InterruptedException ex) {
                    interrupted = true;
    }The ValueObject class which contains the values we want to bind in javafx:
    // ValueObject.java
    import java.util.Observable;
    public class ValueObject extends Observable {
        private String value;
        public String getValue() {
            return this.value;
        public void setValue(String value) {
            this.value = value;
            fireNotify();
        private void fireNotify() {
            setChanged();
            notifyObservers();
    }We also need an adapter class in JFX so we can use bind:
    // ValueObjectAdapter.fx
    import java.util.Observer;
    import java.util.Observable;
    public class ValueObjectAdapter extends Observer {
        public-read var value : String;
        public var valueObject : ValueObject
            on replace { valueObject.addObserver(this)}
        override function update(observable: Observable, arg: Object) {
             // We need to run every code in the JFX EDT
             // do not change if the update method can be called outside the Event Dispatch Thread!
             FX.deferAction(
                 function(): Void {
                    value = valueObject.getValue();
    }And finally the main JFX code which displays the canging value:
    // Main.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    import threadbindfx.TimeServer;
    var timeServer : TimeServer;
    var valueObjectAdapter : ValueObjectAdapter = new ValueObjectAdapter();
    timeServer = new TimeServer();
    valueObjectAdapter.valueObject = timeServer.valueObject;
    timeServer.start();
    Stage {
        title: "Time Application"
        width: 250
        height: 80
        scene: Scene {
            content: Text {
                font : Font {
                    size : 24
                x : 10, y : 30
                content: bind valueObjectAdapter.value;
    }This approach uses less cpu time than constant polling, and changes aren't dependent on the polling interval.
    However this cannot be applied to code which you cannot change obviously.
    I hope this helps.

  • IPhone SDK CodeSign Error: Redux (latest OS X update is broken)

    This bug - http://discussions.apple.com/thread.jspa?threadID=1455699&start=0&tstart=0 - is back. My AdHoc project, which worked perfectly last week, has just stopped building, with this:
    "object file format invalid or unsuitable"
    As soon as I upgraded from 10.5.7 to 10.5.8, this bug appeared.
    However, this bug was officially fixed in 10.5.7 - so, I'm guessing here, Apple has accidentally re-created it.
    Unfortunately, I cannot add to the original post, because Apple has frozen the topic.
    So, here's a new topic to ask if anyone else is having this problem, and what they did about it - is it exactly the same as the old bug? or is it different in some way?
    I'm going to try some of the workarounds for the old bug - but hacking command line scripts isn't fun, and I'm worried I might break something even worse .

    iPhone Dev Center
    Downloads
    Read me before downloading
    If you have updated your device to iPhone OS 3.1.3 with iTunes, you must install iPhone SDK 3.1.3 in order to continue with your development.
    *iPhone SDK 3.1.3*
    iPhone SDK 3.1.3 includes the Xcode IDE, iPhone simulator, and a suite of additional tools for developing applications for iPhone and iPod touch.
    _Posted: February 2, 2010_
    Leopard Build: 9M2809a
    Snow Leopard Build: 10M2003a
    *Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.1.4
    iPhone SDK 3.1.3 with Xcode 3.1.4 Readme
    *Snow Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.2.1
    iPhone SDK 3.1.3 with Xcode 3.2.1 Readme
    *Other Downloads*
    iPhone SDK Agreement
    iPhone Configuration Utility

  • IPhone SDK 2.2 memory corruption

    Hello. I'm working on an application for iPhone SDK 2.2 and seem to be having weird memory corruption problems. Not necessarily leaks because using Instruments shows my memory stamp never going above about 1.8 megs. The nature of the app is a database of animals so I'm constantly loading and unloading sounds and images. None of the objects are very large (at most I'll have 4 800k pngs loaded at once) and I've checked and rechecked my alloc/retain/release and everything is in order (hence no memory usage increase). However...after using the application for a while I'll notice strange behavior. For example:
    1) we have a UILabel as the title for each page. After a while the font size of this will change.
    2) I have several screens with a subclassed UIScrollView where images are loaded and then added to. The problem shows itself here by the images not showing up. there's no crash, stepping through the debugger shows that the image loads up fine, it's just that the image is not there.
    3) I have a UILabel at the top of an animal description screen, which in the nib file is called "Animal Name" by default. This will change to show "Animal Name" at the top.
    I've removed all audio in our latest build so that isn't the problem. What I'm starting to suspect is that altering anything defined in a nib file will cause corruption. For example, the UIScrollView is defined in the nib file, and I constantly am reassigning the contents of that with a UIImageView. This UIImageView is handled within the subview class like :
    UIImageView *imgView = [[UIImageView alloc] initWithImage: [ UIImage imageWithContentsOfFile:[[NSBundle mainBundle ] pathForResource:imageToLoad ofType:@"png" ]] ];
    imgView.tag = 50;
    [self addSubview:imgView ];
    [ imgView release ];
    Then later when moving away from the screen I'll find that view's tag and remove it from the superview (since addSubView increases the retain count, the alloc+addSubView is cancelled by release+removeFromSuperView)
    I can't explain why titles that are never changed would be affected, but it must somehow be related. What I'm wondering is: are there any known issues involving modification of the contents of objects defined in Nib files? Perhaps the memory allocated when initWithNibName is restrained, then any modification of objects allocated within it can cause corruption. I'm starting to think I should just alloc and free anything modified in code and skip using nib files altogether (I reset the text on buttons for example). If this is a known issue please let me know. I'll give you more information if I can.
    Thank you

    Just download the huge SDK package and install. No need to uninstall the old SDK.

  • Problem in set selectedTextcolor in uitableview cell in iPhone SDK 3.1.2

    Hello,
    I set selected text color in uitableview cell using cell.selectedTextColor = [UIColor whiteColor]; for iPhone SDK 2.2.1.
    Now i use iPhone SDK 3.1.2, So for that i make change as per documentation for that i use textLabel properties. But selectedTextColor is not exit.
    So Now for SDK 3.1.2 how to set selectedTextColor?..
    Thank you.

    The textLabel property is an instance of UILabel, so it has its own textColor, textAlignment, and font properties. E.g.:
    cell.textLabel.text = @"foo";
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.textLabel.textAlignment = UITextAlignmentLeft;
    Hope that helps!
    - Ray

Maybe you are looking for

  • Can i use a class for this or do i need to use a type def

    what i am trying to do is have a parent cluster witch has a file name and some free space to put is children's data in with decorations at the bottom. i then need to have a child with a graph in the middle blank space of the parent. i also need to ha

  • Webcam stopped working for one user, still works for another user

    I'm using 2 userprofiles on my laptop. For 1 user, webcam software works as expected. For 2nd user webcam stopped working. For this user: - Autostart Webcamsoftware doesn't work (traybar). - Manual start doesn't work either. - I can see that for each

  • How to use Alias Columns in WHERE CLAUSE

    Hi , I have a query where in there are 2 alias columns, start_date and end_date where in i need to use them in my WHERE clause as start_date < end_date. Please let me know if this is possible. please see the bwlow query SELECT (GREATEST (MIN (a.start

  • Contacts take forever to sync

    I just got an iPhone. I imported about 600 contacts from Now Up to Date & Contact. The contacts often have information in the Notes field (that NUDC uses), but otherwise seem unremarkable in terms of their content. Never-the-less, the iPhone never co

  • Hp Pavilion G6 "Launch Startup Repair" problem

    I have had my Hp Pavilion G6 series laptop for a year or so, and a couple days ago it froze while I using it. I turned it off, and when I got back on a black screen came up titled "Windows Error Recovery". It had two options -Launch Startup Repair