锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 棣栧厛鍙屽嚮 XCode 宸ョ▼涓紝Executables 涓嬬殑 鍙墽琛屾ā緇勶紝 malloc_history ${App_PID} ${Object_instance_addr} 鍒欎細鑾峰緱鐩稿簲鐨?malloc 鍘嗗彶璁板綍錛屾瘮濡傚浜庝笂涓涓帶鍒跺彴杈撳嚭 Untitled[3646:a0f] *** -[CFString release]: message sent to deallocated instance 0x10010d340 鍒欐垜浠彲浠ュ湪緇堢鎵ц錛岀粨鏋滃涓嬶細 Buick-Wongs-MacBook-Pro:Downloads buick$ malloc_history 3646 0x10010d340 榪欐牱灝卞彲浠ュ緢蹇殑瀹氫綅鍑洪棶棰樼殑浠g爜鐗囨浜嗭紝娉ㄦ剰杈撳嚭鐨勬渶鍚庝竴琛岋紝錛岋紝榪欒铏界劧涓嶆槸闂鐨勬渶緇堝師鍥狅紝浣嗘槸紱婚棶棰樼偣宸茬粡寰堣繎浜嗭紝闅忕潃瀹冩壘涓嬪幓錛屽叓鎴愬氨浼氭壘鍒伴棶棰樸?br />
褰?/span>retain 鏃舵槸琛ㄧず鎸囧悜浜嗗悓涓涓唴瀛樼┖闂達紝鍙槸鍐呭瓨絀洪棿鐨?/span>retainCount鍔犱簡1錛屽叾浠栫殑閮芥病鍙橈紝浣嗘槸褰?/span>copy鏃訛紝濡傛灉閭d釜鍐呭瓨鍗曞厓閲岄潰鐨勫兼槸涓嶅彲鍙樼殑鏃跺欙紝鎴戜滑璺?/span>retain鏄竴鏍風殑錛屽彧鏄唴瀛樼┖闂寸殑retainCount鍔犱簡1錛佸鏋滈偅涓唴瀛樺崟鍏冮噷闈㈢殑鍊兼槸鍙彉鐨勬椂鍊欙紝鍏跺疄鍦ㄥ湪鍐呭瓨涓彟澶栫粰鍒嗛厤浜嗕竴鍧楀唴瀛樼┖闂達紝鐒跺悗鎶婂艱祴緇欏唴瀛樼┖闂撮噷闈€傚師鏉ラ偅涓唴瀛樼┖闂寸殑retainCount涓嶅姞1錛岀幇鍦ㄦ柊鍒嗛厤鐨勫唴瀛樼┖闂?/span>retainCount鍔?/span>1. #ifndef __OPTIMIZE__ # define NSLog(...) NSLog(__VA_ARGS__) #else # define NSLog(...) {} #endif
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BASEVERNUM.$REV" "${INFOPLIST_FILE}"
]]>
]]>
鍦ㄥ脊鍑虹獥鍙d腑錛孷ariables to be set in the environment錛屾坊鍔?NSZombieEnabled錛屽茍璁懼畾涓?YES錛岀偣鍑婚変腑澶嶉夋鍚敤姝ゅ彉閲忋?br />
榪欐牱錛岃繍琛?Objective-C 鏃朵細鐪嬪埌鎺у埗鍙拌緭鍑洪敊璇俊鎭?br />
榪欐潯娑堟伅瀵逛簬瀹氫綅闂鏈夊緢濂界殑鎻愮ず浣滅敤銆備絾鏄緢澶氭椂鍊欙紝鍙湁榪欐潯鎻愮ず鏄笉澶熺殑錛屾垜浠渶瑕佹洿澶氱殑鎻愮ず鏉ュ府鍔╁畾浣嶉棶棰橈紝榪欐椂鍊欏啀鍔犲叆 MallocStackLogging 鏉ュ惎鐢╩alloc璁板綍銆?br />
褰撻敊璇彂鐢熷悗錛屽湪緇堢鎵ц錛?
malloc_history Report Version: 2.0
Process: Untitled [3646]
Path: /Users/buick/Desktop/Untitled/build/Debug/Untitled
Load Address: 0×100000000
Identifier: Untitled
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: gdb-i386-apple-darwin [3638]
Date/Time: 2011-02-01 15:07:04.181 +0800
OS Version: Mac OS X 10.6.6 (10J567)
Report Version: 6
ALLOC 0x10010d340-0x10010d357 [size=24]: thread_7fff70118ca0 |start | main | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | +[NSString initialize] | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | NXCreateMapTableFromZone | malloc_zone_malloc
鈥?
FREE 0x10010d340-0x10010d357 [size=24]: thread_7fff70118ca0 |start | main | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | _finishInitializing | free
ALLOC 0x10010d340-0x10010d357 [size=24]: thread_7fff70118ca0 |start | main | -[NSPlaceholderString initWithString:] | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | _class_initialize | +[NSMutableString initialize] | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | NXCreateMapTableFromZone | malloc_zone_malloc
鈥?
FREE 0x10010d340-0x10010d357 [size=24]: thread_7fff70118ca0 |start | main | -[NSPlaceholderString initWithString:] | objc_msgSend | lookUpMethod | prepareForMethodLookup | _class_initialize | _class_initialize | _finishInitializing | free
ALLOC 0x10010d340-0x10010d35f [size=32]: thread_7fff70118ca0 |start | main | -[NSCFString substringWithRange:] | CFStringCreateWithSubstring | __CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance | malloc_zone_malloc
]]>
2 NSLog(@"tempString retainCount-----%D",[tempString retainCount]);
3 NSLog(@"tempString -----%p---%p",tempString,&tempString);
4
5 NSMutableString*string1=[tempString retain];
6 NSLog(@"string1 retainCount-----%D",[string1 retainCount]);
7 NSLog(@"string1 -----%p---%p",string1,&string1);
8
9 NSMutableString*string2=[tempString mutableCopy];
10 NSLog(@"string2 retainCount-----%D",[string2 retainCount]);
11 NSLog(@"string2 -----%p---%p",string2,&string2);
12
13
14 NSString*s=[[NSString alloc]initWithFormat:@"%@",@"hello"];
15 NSLog(@"s retainCount-----%D",[s retainCount]);
16 NSLog(@"s -----%p---%p",s,&s);
17 NSString*st=[s copy];
18 NSLog(@"st retainCount-----%D",[st retainCount]);
19 NSLog(@"st -----%p---%p",st,&st);
20 NSString*str=[s retain];
21 NSLog(@"str retainCount-----%D",[str retainCount]);
22 NSLog(@"str -----%p---%p",str,&str);
]]>
]]>
鎵浠ュ氨鐢ㄤ互涓嬫柟娉曚簡,甯屾湜鑳藉澶у鏈夊府鍔?br />
-(void)initvalue
{
NSString *url=[[NSUserDefaults standardUserDefaults] objectForKey:kConnection];
if (url==nil) {
NSString *stringBundle=[[NSBundle mainBundle] bundlePath];
NSString *settingBundle=[stringBundle stringByAppendingPathComponent:@"Settings.bundle"];
NSString*listBundle=[settingBundle stringByAppendingPathComponent:@"Root.plist"];
NSDictionary*rootDict=[NSDictionary dictionaryWithContentsOfFile:listBundle];
NSArray*array=[rootDict objectForKey:@"PreferenceSpecifiers"];
NSDictionary*preItem;
NSString*connection=nil;
for (preItem in array) {
NSString*key=[preItem objectForKey:@"Key"];
id defaultValue=[preItem objectForKey:@"DefaultValue"];
if ([key isEqualToString:@"connection"]) {
connection=@" http://www.baidu.com";
}
}
NSDictionary *dictionary=[[NSDictionary alloc]initWithObjectsAndKeys:connection,@"connection",nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
[[NSUserDefaults standardUserDefaults] synchronize];
[dictionary release];
[stringBundle release];
[rootDict release];
[preItem release];
}
}
]]>
鍏堣璇嗕竴涓婣SIHttpRequest
濡傛灉瑕佺敤鍒癆SIHttpRequest鍏堣鍚戝伐紼嬩腑鍔犲叆CFNetwork.framework
SystemConfiguration.framework, MobileCoreServices.framework, CoreGraphics.framework and libz.1.2.3.dylib
鐒跺悗鍐嶅伐紼嬩腑鍔犲叆鎵鐢ㄥ埌鐨勫寘ASIHttpRequest
鎺ヤ笅鏉ュ氨鍙啓浠g爜浜?br />
#import "TestAsiHttpreqeustViewController.h"
#import "ASIHTTPRequest.h"
@implementation TestAsiHttpreqeustViewController
-(void)viewDidLoad
{
ASIHTTPRequest*request=[ASIHTTPRequest requestWithURL:[NSURL URLWithString:@" http://172.16.20.14:8090/test.html"]];
[request setDelegate:self];
[request startSynchronous];
}
-(void)requestFinished:(ASIHTTPRequest *)request
{
NSString*responseString=[request responseString];
NSLog(responseString);
}
榪欏彧鏄竴涓緢綆鍗曠殑ASIHttpRequest搴旂敤錛屾垜涔熷湪鐮旂┒涓紝鍛靛懙錛屽笇鏈涘鍒濆鑰呮湁涓鐐瑰府鍔?/font>
]]>