2010-01-27 15 views
0

我是一個新手,需要在模擬器上運行的iPhone應用程序的一些幫助。使用Build & Run或Build &運行 - 斷點關閉,但在使用Build &運行時出現調試 - 斷點處於打開狀態。任何幫助或想法將不勝感激。 LoniPhone內存錯誤 - 使用Build&Debug時,如何調試?

細節:沒有設置斷點,永遠不會看到任何可見的模擬器結果,在初始化階段似乎會產生任何輸出。應用程序的源代碼是DrinkMixer的例子,由Dan & Tracey Pilone撰寫的「Head First iPhone development」一書(示例建立在第280頁)。

吹燈與此錯誤消息:

Attaching to process 970. 
Pending breakpoint 1 - "*0x01c1b001" resolved 
Program received signal: 「EXC_BAD_ACCESS」. 
No memory available to program now: unsafe to call malloc 
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.) 
No memory available to program now: unsafe to call malloc 
--- 
Leaks: 
The only object noted as "leaked Object" is: 
Leaked Object # Address Size Responsible Library Responsible Frame 
Malloc 128 Bytes <blank> 0x3c11950 128Bytes CoreGraphics open_handle_to_dylib_path 
___ 

Object Allocations shows (Highest at top = CFString): 

Category --- Overall Bytes -- #Overall -- Live Bytes -- #Living 
* All Allocations * 497kb  #5888 496kb #5878 10 
CFString    42kb  #1126 42kb  
Malloc 32.00 KB 32kb  #1  32kb 
Malloc 1.00 KB 29kb  #29  29kb 
Malloc 8.00 KB 24kb  #3  24kb  
Malloc 32 Bytes 20.81kb #666 20.75kb 
Malloc 1.50 KB 19.5kb #13  19.5kb 
CFDictionary (key-store) 17.64kb #159 17.64kb 

(note: Except for "All Allocations, the #Living is the same as #Overall) 
--- 

List of Calls from Debugger: 

#0 0x01c1b010 in CFStringCreateByCombiningStrings 
#1 0x023a0779 in LoadFontPathCache 
#2 0x023a096b in Initialize 
#3 0x023a0f3e in GSFontCreateWithName 
#4 0x003d4575 in +[UIFont boldSystemFontOfSize:] 
#5 0x002cddaa in +[UINavigationButton defaultFont] 
#6 0x002d9e37 in -[UINavigationButton initWithValue:width:style:barStyle:possibleTitles:tintColor:] 
#7 0x002cdc75 in -[UINavigationButton initWithImage:width:style:] 
#8 0x00468eeb in -[UIBarButtonItem(Static) createViewForNavigationItem:] 
#9 0x002d1b56 in -[UINavigationItem customRightView] 
#10 0x002d20e3 in -[UINavigationItem updateNavigationBarButtonsAnimated:] 
#11 0x002d1e1a in -[UINavigationItem setRightBarButtonItem:] 
#12 0x00002e7b in -[RootViewController viewDidLoad] at RootViewController.m:41 
#13 0x00313796 in -[UIViewController view] 
#14 0x00311d92 in -[UIViewController contentScrollView] 
#15 0x0031c2b4 in -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] 
#16 0x0031b32e in -[UINavigationController _layoutViewController:] 
#17 0x0031cd1a in -[UINavigationController _startTransition:fromViewController:toViewController:] 
#18 0x0031831a in -[UINavigationController _startDeferredTransitionIfNeeded] 
#19 0x004362e4 in -[UILayoutContainerView layoutSubviews] 
#20 0x035342b0 in -[CALayer layoutSublayers] 
#21 0x0353406f in CALayerLayoutIfNeeded 
#22 0x035338c6 in CA::Context::commit_transaction 
#23 0x0353353a in CA::Transaction::commit 
#24 0x00295ef9 in -[UIApplication _reportAppLaunchFinished] 
#25 0x0029bb88 in -[UIApplication handleEvent:withNewEvent:] 
#26 0x002976d3 in -[UIApplication sendEvent:] 
#27 0x0029e0b5 in _UIApplicationHandleEvent 
#28 0x023a3ed1 in PurpleEventCallback 
#29 0x01bb6b80 in CFRunLoopRunSpecific 
#30 0x01bb5c48 in CFRunLoopRunInMode 
#31 0x00295e69 in -[UIApplication _run] 
#32 0x0029f003 in UIApplicationMain 
#33 0x00002ba0 in main at main.m:14 

的代碼,其中包括線路#41(下面說明)如下。而感謝格式幫助和評論:

#import "RootViewController.h" 
#import "DrinkDetailViewController.h"; 
#import "DrinkConstants.h" 
#import "AddDrinkViewController.h" 
@implementation RootViewController 
@synthesize drinks, addButtonItem; 
- (void)viewDidLoad { 
    [super viewDidLoad];  
    // add PATH for PLIST 
    NSString *path = [[NSBundle mainBundle] pathForResource: 
         @"DrinkDirections" ofType:@"plist"]; 
    NSMutableArray *tmpArray = [[NSMutableArray alloc]        initWithContentsOfFile:path]; 
    self.drinks = tmpArray; 
    [tmpArray release]; 

// Next is Line #41 - I removed earlier empty lines & Comments 

    self.navigationItem.rightBarButtonItem = self.addButtonItem; 

} 
- (IBAction) addButtonPressed: (id) sender { 
    NSLog(@"Add button pressed!"); 

+0

那麼你周圍RootViewController.m的41行嗎?顯示一些代碼。 – 2010-01-27 03:08:37

回答

相關問題