iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
georgetso
V2EX  ›  iDev

研究 associationObject 的时候发现一个奇怪的现象,求解释

  •  
  •   georgetso · Sep 19, 2015 · 1870 views
    This topic created in 4025 days ago, the information mentioned may be changed or developed.
    代码地址 http://pan.baidu.com/s/1o6BvfsQ

    奇怪的地方是对象的地址不同
    2015-09-19 13:31:15.306 test[80165:2126493] -[TestObj init] TestObj 0x7fff59b4fa98
    2015-09-19 13:31:15.309 test[80165:2126493] -[TestObj dealloc] TestObj 0x7fff59b500f8

    求高人解释
    2 replies  •  2015-09-19 14:06:05 +08:00
    ibcker
        1
    ibcker  
       Sep 19, 2015   ❤️ 1
    NSLog (@"%s %@ %p", __PRETTY_FUNCTION__, self.class, &self );
    改为
    NSLog (@"%s %@ %p", __PRETTY_FUNCTION__, self.class, self );
    ibcker
        2
    ibcker  
       Sep 19, 2015
    给你写个例子,再不明白就没办法了···google 关键词:指针的指针··

    TestObj *obj = [TestObj new];

    NSLog (@"obj->%p",obj );
    NSLog (@"&obj->%p",&obj );

    TestObj *obj2 = obj;
    NSLog (@"obj2->%p",obj2 );
    NSLog (@"&obj2->%p",&obj2 );
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2567 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:26 · PVG 13:26 · LAX 22:26 · JFK 01:26
    ♥ Do have faith in what you're doing.