[iPhone SDK] property/retain count mystery

I'm confused as to the behavior of the following code:
UIViewController *viewController = [[UIViewController alloc] init];
UITabBarItem *barItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts tag:1];
printf("1: %d
", barItem.retainCount); // is 1 as expected
viewController.tabBarItem = barItem;
printf("2: %d
", barItem.retainCount); // is 2 as expected
viewController.tabBarItem;
printf("3: %d
", barItem.retainCount); // expected 2 but got 3
[viewController.tabBarItem release]; // seems that accessing the tabBarItem increments the retain count, then release decrements it - so this is a noop
printf("4: %d
", barItem.retainCount); // still 3
output is:
1: 1
2: 2
3: 3
4: 3
It appears as if just calling viewController.tabBarItem increments the retain count? (fwiw same thing happens if I call [viewController tabBarItem])
I know that the tabBarItem @property of UIViewController has the retain attribute, but that means every time I access the property's getter, I'm issuing a retain? I thought it would only retain when set.
What am I missing here?
Thanks!

Thanks for the tips - looks like that's what's happening. Rereading the memory management guide more carefully, under Accessor Methods I see:
For simple object values, getters and setters can be written in one of the following three ways:
1. Getter retains and autoreleases the value before returning it; setter releases the old value and retains (or copies) the new value.
2. Getter returns the value; setter autoreleases the old value and retains (or copies) the new value.
3. Getter returns the value; setter releases the old value and retains (or copies) the new value.
The tabBarItem method must be implemented as #1. Still trying to get my head around an example where this would be necessary, but thanks for the help.

Similar Messages

  • Property behaviour curiosity with retain counts

    Hey folks,
    I've been encountering a behaviour with retain counts and properties that I don't expect. I hope someone can clear it up. Assuming this contrived code:
    // Public header
    @interface ObjectB : NSObject
    float m_FloatValue;
    @property(readwrite) floatValue;
    @end
    @interface ObjectA : NSObject
    ObjectB* m_MemberB;
    @property(retain) ObjectB* memberB;
    @end
    // Implementation file
    @implementation ObjectB
    @synthesize floatValue = m_FloatValue
    @end
    @implementation ObjectA
    @synthesize memberB = m_MemberB;
    @end
    Now the trick is that this line of code:
    float valueOfB = anObjectA.memberB.floatValue;
    ... causes m_MemberB to be retained. This seems odd to me, since all I'm trying to do is dig down and pull out the float value of B. Is the default implementation of a (retain)ed property's getter incrementing the retain count? Does it assume I'm storing my reference to that member, so it had better retain it for me to be clever?
    I find this behaviour is causing excess retain counts all over my current app, and I'm having to work around it by implementing my own getters for retained member variables. Am I missing something here, or using something incorrectly? Any information would be much appreciated.
    If it matters, this code is Objective-C 2.0 on the iPhone.
    Thanks!

    I tried your example and reproduced your result, except anObjectA.memberB.floatValue caused m_MemberB to be retained not once, but twice. Then I found that changing from dot to message syntax caused only one retain(??):
    // this causes ObjectB::retain to be called twice
    float valueOfB = anObjectA.memberB.floatValue;
    // this causes ObjectB::retain to be called once
    float valueOfB = [[anObjectA memberB] floatValue];
    The behavior was consistent over several trials with OS 2.1 on both the Simulator and the Device. I also changed the instance variable name to match the property name to rule out a problem with the +@synthesize a=b+ syntax, but this didn't affect the results.
    The advice that's often given in this forum is that observing retain counts is useless since their meaning at any particular stage of execution can't be interpreted (since we don't know how many autoreleases are pending?). In short, "Cocoa knows what it's doing and if you follow the rules you'll wind up with an equal number of retains and releases".
    That said, the above results aren't the kind that inspire much confidence. Hopefully someone who knows what's going on will join this thread soon.

  • 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.

  • Release memory in iPhone SDK

    Hi,
    1. I want to release previous memory before I redraw the screen. Is this the right way to do it using iPhone SDK?
    [self.securityCodeView release];
    self.securityCodeView = [[SecurityCodeView alloc] initWithFrame:Frame];
    [self addSubview:securityCodeView];
    [\b]
    2. How do I refresh the screen without having to ALLOC memeory again? For example, I draw the screen ([self addSubview:securityCodeView]) and after one second, the screen needs to be redrawn (what statement to use?).
    3. How do you retain some UIViews without redrawing since they don't need to be redrawn again (what statement to use)? For example, backgroundView needs not to be redrawn.
    Thank you.

    I would suggest you read the docs on Memory Management on Obj-C. Basically anything you allocate explicitly will remain allocated (with a ref count of 1) until you explicitly do a release:
    [myView release];
    When you add a view to another view's subview, that view's ref count is incremented. So you can safely release the added view and yet use the references to the object throughout the code (as long as the parent view is not released/deallocated).

  • 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.

  • 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

  • How to switch between views in iPhone SDK

    I have been tasked to learn the iPhone SDK. I know Actionscript, Javascript and some Java, but I cannot understand the iPhone SDK at all. I cannot understand the syntax or how the multitude of files work together. Also, there are no tutorials for complete beginners that show step-by-step what to do and why.
    All I am trying to make is an application with a couple of views that change when the user touches a button. What is the easiest way to switch from one view to another?
    Also, what is an AppDelegate? What is "synthesize"? What is "nonatomic,retain"? Why can't I write code like this... theButton.onClick=loadView("NewView");

    Ok, you really need to read up some on how Objective-C and Cocoa work.
    That said, If you make a new project in XCode using the "Utility" template, you can immediately run it and see a view transition (flip).
    Ultimately, however, what you're looking to do is way beyond what you should be expecting to be to be able to do at this point. Programming a scripting language (Javascript, ActionScript) is much different than programming in C/C+/Objective-C/Objective-C+. While not directly applicable to the iPhone, you'll probably want to buy and read Aaron Hillegass' book "Cocoa Programming for Mac OX X 3rd Edition".
    There is a tutorial on the iPhone Dev Center (log in, main page, bottom right, under "resource types", click "Guides", and look for "iPhone Application Tutorial" on the next page) that is worth reading.
    rob.

  • 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.

  • 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.

  • 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

  • Delay/sleep/wait in an iPhone SDK app?

    I'm trying to get some numbers to count up on the screen of my iPhone, but I can't see any way of delaying the app.
    I have a for loop that changes the figures on-screen from one value to another by individual increments, but when I run it, you only see the final figure because it runs so fast.
    Is there a way of adding a delay in the for loop so that the numbers visibly change? I'd like to see 0 change to 1 change to 2 change to 3 etc. instead of, erm, just 3.
    I thought of putting a second for loop in that counted up to, say, a million, but that's too fudgey for me. I'm sure there's a delay function in the iPhone SDK...

    You can also do eg. [NSThread sleepForTimeInterval:5.0] to sleep for 5 seconds..

  • Sub Views and Retain Count

    I am currently creating an app. I am adding sub views to the application like this (it's a feature that switches between a map and a list view):
    MapViewController *mapView = [[MapViewController alloc] init];
    ListViewController *listView = [[ListViewController alloc] init];
    switch (segmentedControl.selectedSegmentIndex) {
    case 0:
    [segmentView addSubview:mapView.view];
    break;
    case 1:
    [segmentView addSubview:listView.view];
    break;
    default:
    break;
    [mapView release];
    [listView release];
    The problem is - that the [listView release] makes my app crash while [mapView release] doesn't. Can someone explain some light on why? MapViewController inherits from UIViewController while ListViewController inherits from UITableViewController.
    EDIT: for some weird reason the editing screws up here but I hope you can read what my problem is regardless.
    Message was edited by: simnie

    simnie wrote:
    ... I just don't get why releasing my list view controller crashes the program while releasing the map view controller does not.
    When you release both controllers at the end of the code block you posted, the retain count for each of those controllers will go to zero, and they will be deallocated, even though--as you pointed out--the view which was added to 'segmentView' will continue to be retained by its superview (i.e. prior to the release of its controller, its retain count was +2, since it had been retained by the controller when the controller and view were created, then retained again by the superview).
    If and when the program crashes depends on whether and when any messages are sent to the deallocated objects. As soon as the table view is added to the superview, it's going to start sending messages to its data source, so if the invalid 'listView' address is also the address of the table view's data source, I would expect an immediate crash. To provoke a crash because of the invalid 'mapView' address, someone would need to send a message to that address.
    I have solved the issue by making the controllers properties in the class instead and releasing them in the dealloc method.
    This is the correct solution. You want each controller to be retained by the respective property setter.
    Btw, I'm not sure why you create both controllers in a method that only seems to use one of them. Since you're now using a retaining property to store the address of each controller you won't leak the memory for the controller when you enter that code multiple times, because the setter for that property will automatically release the previous controller when you replace it with a new one.
    However you might be leaking the memory for the visible view when you enter that code multiple times, since I don't see any code to remove the old view(s). In other words, if you run that code block over and over, it looks like the views you're adding to 'segmentView' will just be layered on top of any previous views, since--as discussed--when the controller is released, the view will still be retained by its superview.
    If the above applies, I would recommend code that only creates each controller one time, as needed. E.g. you could test the property for that controller, and only create a new one if the property is nil. By limiting the number of controllers that get created, you should only have two views at a time, so that problem won't be critical.
    \- Ray
    Message was edited by: RayNewbie

  • Custom UITableViewCell from Interface Builder with retain count 2

    Hi!
    I am creating a customViewCell in my UITableViewController (which I was creating in IB) - the wired thing: it has a retain count of 2! Any hints why?
    UIViewController *c = [[UIViewController alloc] initWithNibName:CellIdentifier bundle:nil];
    GroupCell *cell;// = [[[GroupCell alloc] init] autorelease];
    cell = (GroupCell *) c.view;
    [c release];
    NSDictionary *groupDict;
    NSLog(@"retain count of groupCell: %d, ", [cell retainCount] );
    retain count of groupCell = 2!!
    my cell has no init method, no "retain" nor do I send anywhere a retain to it..

    Hey Alex!
    sommeralex wrote:
    I am creating a customViewCell in my UITableViewController (which I was creating in IB) - the weird thing: it has a retain count of 2! Any hints why?
    Your code is obtaining the retain count by sending the [retainCount|http://developer.apple.com/library/ios/documentation/Cocoa/Referen ce/Foundation/Protocols/NSObjectProtocol/Reference/NSObject.html#//appleref/doc/uid/20000052-BBCDAAJI] message, so this warning in the doc applies:
    Important: This method is typically of no value in debugging memory management issues. Because any number of framework objects may have retained an object in order to hold references to it, while at the same time autorelease pools may be holding any number of deferred releases on an object, it is very unlikely that you can get useful information from this method.
    I think the above is telling us that retainCount returns an accurate number, but that number is useless because we don't know how many releases are pending. E.g., suppose your code has released an object prematurely, so your logical count should be zero. However, if the runtime system has retained the object 5 times at that stage, retainCount will return 5. The point is that all 5 of those retains will be released at some future time not of our choosing.
    You can override retain and release to keep your own count, but I don't know if that count is any more useful than what you get from retainCount.
    I think the only retain count that's any of our business is the number of retains and releases we see in our code. In other words, I think the logical count is much more useful than the real count:
    UIViewController *c = [[UIViewController alloc]
    initWithNibName:CellIdentifier bundle:nil]; // Line A: +1
    GroupCell *cell;
    cell = (GroupCell *) c.view; // Line B
    [c release]; // Line C: -1
    NSLog(@"retain count of groupCell: %d, ", [cell retainCount] );
    Based on the doc for the ['view' property of UIViewController|http://developer.apple.com/library/ios/documentation/UIKit/Ref erence/UIViewControllerClass/Reference/Reference.html#//appleref/doc/uid/TP40006926-CH3-SW2], the view object should be created and retained once when the nib is loaded in Line A (except if no view object is included in the nib, in which case the view would be created and retained once in Line B). The view would then be released once when the view controller is released in Line C.
    So using my arithmetic, the view's retain count is zero after Line C. If that's correct, the only thing saving you from a crash might be one of those system retains we don't know about. You could test my analysis by not giving the view to a table view, then checking to see if it still exists at some point after the end of the current event cycle. You could implement dealloc with a NSLog statement in your custom view to see if and when the view is actually freed.
    Absent any further analysis, I would advise retaining and autoreleasing the view before releasing the controller (or just autoreleasing the controller), to make sure the view lasts until retained by your table view.
    - Ray

  • IPhone SDK:  Vectors / Matrices

    Are there any solutions in Obj-C for doing 2D/3D vector ops. in the iPhone SDK? I haven't been able to find anything this far...
    Lame struct's like CGPoint don't count, I mean something with a full compliment of arithmetic operations. Closest I found has been vecLib.h , which is in C, and which doesn't appear to be included among the iPhone OS library headers...
    * Bonus points for efficiency, if the implementation is likely to use any native instructions.
    Thanks in advance - would be nice if I didn't have to write this...

    It is the "iPhone Software Development Kit" SDK to allow you to write the next big trick app for the iPhone and make a gozillion dollars.

  • ITunes 9 and iPhone SDK 3.0

    Hi there,
    I downloaded and installed iTunes 9 yesterday by hand since the software update tool didn't have it yet. However during install, he asked me to close my Xcode (v.3.2 with iPhone 3.0 sdk that came with the Leopard Upgrade Disc) and when I fired it up again, the iPhone projects Template section was gone, making me download the whole 2.2 gb for Xcode 3.2 with iPhone sdk 3.1.
    I understand, that the iTunes 9 installation probably removed all traces of the 3.0 Framework but would waiting for proper updates through the Software Update tool spare me from such adventures during future firmware releases?
    Thanks in advance!

    Ok, here is the EXACT thing that I have on my iTunes that is working on my iPhone. (I haven't checked on the Shuffle yet) First screen--iPhone itself--nothing checked except Automatically sync when this iPhone is connected. Now Podcasts Tab on iPhone screen (right side of iTunes--center really--at least not the left side) Checked Sync Podcasts at Top. Also Checked Automatically include ALL episodes of SELECTED podcasts. Now here is where it seems weird. I have NONE of the podcasts themselves checked. Scroll Down further and there is a check box for Includes Episodes from Playlists. I have both of my Smart Playlists checked and they are both working correctly.
    One more thing, I have in my Smart Playlist a rule saying Play Count is 0. That way after I have completely listened to the entire podcast it will be deleted from that playlist. If I am halfway through the podcast--that is saved and it starts playing at that point.

Maybe you are looking for

  • The design of this website is confusing and hard to use.

    Adobe are regarded as the industry standard of design software, so it seems ironic (or embarrassing) that this website is so poorly designed. I came here simply wanting to post a question about Flash Player but found it the whole experience to be con

  • How to display a screen in selection-screen?

    hi friends, I have a requirement. I have one PNP database SELECTION-SCREEN in my report program. And i have created one more screen using screen painter. Now i hae to display that screen which i created using screen painter under PNP SELECTION-SCREEN

  • Problem with Panasonic P2

    I am new to this forum and hope someone can help me. I shot video by Panasonic AG-HVX203 to shoot video in DVCPRO HD (1080/50i) format.  This is PAL format.  Video is stored in P2 card.  And then I import the MXF files to the timeline of Premiere CS4

  • Show/hide based on Multiple selections in a select box

    In my http header I have the following code... it works great as long as only one value is selected: if you highlight the ARRAMO value the DUNS field appears... if you highlight anything else the DUNS field disappears... but if I highlight both ARRAM

  • How to use 'call funtions' in screens?

    Hi all, I am developing a screen through SE51 and have used a smart form to print out the data after it is saved. the smart form is called using CALL FUNCTION. I want to come back to the main screen after the smart form is executed. How can I do this