Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-06-2011, 01:10 PM   #1 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default symbolicating crash logs - wtf?!

I received some crash reports from a user and am stumbling over myself trying to figure out how to use symbolicatecrash.

I'm using xcode 3.2.6, and did not use "build and archive" to release this version. However, I did keep the dSYM file.

Currently I have created a folder on my desktop that contains the dSYM file, the .app, and the .crash files.

In terminal I run:
Code:
my-mac-book-pro:Resources MyName$ ./symbolicatecrash myApp_2011-08-29-170743_Users-iPhone.crash
And I get a mess of error messages:
Code:
Can't exec "/usr/bin/xcode-select": No such file or directory at ./symbolicatecrash line 63.
Use of uninitialized value $devToolsPath in scalar chomp at ./symbolicatecrash line 64.
xcrun: error: developer tools not installed; download from http://developer.apple.com
xcrun: error: developer tools not installed; download from http://developer.apple.com
Use of uninitialized value $devToolsPath in quotemeta at ./symbolicatecrash line 81.
while reading myApp_2011-08-29-170743_Users-iPhone.crash, No such file or directory :  at ./symbolicatecrash line 622.
What am I doing wrong? I also tried just dragging and dropping the .crash file into organizer but that just opens up the un-symbolicated file-- no changes.

Please help!!!
DrBeak1 is offline   Reply With Quote
Old 09-06-2011, 02:51 PM   #2 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Maybe some progress here:
First here is one of the crash logs, UNSYMBOLICATED:
Code:
Incident Identifier: 7E4CE40C-B177-4A0C-A1E8-CC8E4F5DAEAC
CrashReporter Key:   2bb8ca00ae08ebfee4cb83e79f0c94fa4d501738
Hardware Model:      iPhone3,1
Process:         myApp [991]
Path:            /var/mobile/Applications/C9FA75AE-07CA-41CF-B5A7-3B5B08AD4A3E/myApp.app/myApp
Identifier:      myApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-08-30 19:43:21.153 +0200
OS Version:      iPhone OS 4.3.5 (8L1)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x347e2a1c 0x347d1000 + 72220
1   libsystem_c.dylib             	0x3481c3b4 0x347e9000 + 209844
2   libsystem_c.dylib             	0x34814bf8 0x347e9000 + 179192
3   libstdc++.6.dylib             	0x338d5a64 0x33891000 + 281188
4   libobjc.A.dylib               	0x33d9506c 0x33d8f000 + 24684
5   libstdc++.6.dylib             	0x338d3e36 0x33891000 + 273974
6   libstdc++.6.dylib             	0x338d3e8a 0x33891000 + 274058
7   libstdc++.6.dylib             	0x338d3f5a 0x33891000 + 274266
8   libobjc.A.dylib               	0x33d93c84 0x33d8f000 + 19588
9   CoreFoundation                	0x36b3e1b8 0x36a9c000 + 663992
10  CoreFoundation                	0x36b3d642 0x36a9c000 + 661058
11  CoreFoundation                	0x36ab4178 0x36a9c000 + 98680
12  myApp                         	0x000452c4 0x1000 + 279236
13  myApp                         	0x00048f26 0x1000 + 294694
14  myApp                         	0x00049f84 0x1000 + 298884
15  myApp                         	0x00049dd4 0x1000 + 298452
16  myApp                         	0x000491c4 0x1000 + 295364
17  myApp                         	0x00049570 0x1000 + 296304
18  UIKit                         	0x35956eb8 0x35920000 + 224952
19  myApp                         	0x0004d5ae 0x1000 + 312750
20  myApp                         	0x0004d850 0x1000 + 313424
21  UIKit                         	0x35956f08 0x35920000 + 225032
22  UIKit                         	0x359655e8 0x35920000 + 284136
23  UIKit                         	0x35965458 0x35920000 + 283736
24  UIKit                         	0x35965356 0x35920000 + 283478
25  UIKit                         	0x35964e2e 0x35920000 + 282158
26  UIKit                         	0x35964c3c 0x35920000 + 281660
27  UIKit                         	0x35956d56 0x35920000 + 224598
28  UIKit                         	0x35956acc 0x35920000 + 223948
29  myApp                         	0x00006f08 0x1000 + 24328
30  CoreFoundation                	0x36aaa56a 0x36a9c000 + 58730
31  UIKit                         	0x3593cec2 0x35920000 + 118466
32  UIKit                         	0x359c9c1a 0x35920000 + 695322
33  CoreFoundation                	0x36aaa56a 0x36a9c000 + 58730
34  UIKit                         	0x3593cec2 0x35920000 + 118466
35  UIKit                         	0x3593ce62 0x35920000 + 118370
36  UIKit                         	0x3593ce34 0x35920000 + 118324
37  UIKit                         	0x3593cb86 0x35920000 + 117638
38  UIKit                         	0x3593d41c 0x35920000 + 119836
39  UIKit                         	0x3593bbee 0x35920000 + 113646
40  UIKit                         	0x3593b568 0x35920000 + 111976
41  UIKit                         	0x3592430c 0x35920000 + 17164
42  UIKit                         	0x35923c4c 0x35920000 + 15436
43  GraphicsServices              	0x3625ee70 0x3625a000 + 20080
44  CoreFoundation                	0x36b11a90 0x36a9c000 + 481936
45  CoreFoundation                	0x36b13838 0x36a9c000 + 489528
46  CoreFoundation                	0x36b14606 0x36a9c000 + 493062
47  CoreFoundation                	0x36aa4ebc 0x36a9c000 + 36540
48  CoreFoundation                	0x36aa4dc4 0x36a9c000 + 36292
49  GraphicsServices              	0x3625e418 0x3625a000 + 17432
50  GraphicsServices              	0x3625e4c4 0x3625a000 + 17604
51  UIKit                         	0x3594ed62 0x35920000 + 191842
52  UIKit                         	0x3594c800 0x35920000 + 182272
53  myApp                         	0x0000263a 0x1000 + 5690
54  myApp                         	0x000025d0 0x1000 + 5584
If I am correct in suspecting lines
Code:
12  myApp                         	0x000452c4 0x1000 + 279236
13  myApp                         	0x00048f26 0x1000 + 294694
as the locations causing the crash then maybe I have found the locations.
So I used this in terminal:
atos -o myApp.app.dSYM/Contents/Resources/DWARF/myApp -arch armv6 0x000452c4

and

atos -o myApp.app.dSYM/Contents/Resources/DWARF/myApp -arch armv6 0x00048f26

Which pointed to:
Code:
-[KalGridView receivedTouches:withEvent:] (in myApp) (KalGridView.m:118)
 //AND
-[KALDataSource loadItemsFrom:to:delegate:] (in myApp) (KALDataSource.m:147)
respectively.

Here are the methods it is pointing to, again respectively, but I cannot see any issues:
Code:
- (void)receivedTouches:(NSSet *)touches withEvent:event
{
  UITouch *touch = [touches anyObject];
  CGPoint location = [touch locationInView:self];
  UIView *hitView = [self hitTest:location withEvent:event];
  
  if (!hitView)
    return;

  //ATOS SPECIFICALLY INDICATES THE "IF" LINE BELOW
  if ([hitView isKindOfClass:[KalTileView class]]) {
    KalTileView *tile = (KalTileView*)hitView;
    if (tile.belongsToAdjacentMonth) {
      self.highlightedTile = tile;
    } else {
      self.highlightedTile = nil;
      self.selectedTile = tile;
    }
  }
}
Code:
- (void)loadItemsFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{

	int i;
	
	for (i = 0; i < [MainDataArray count]; i++) {
		NSString *name;
		NSString *comment;
		NSString *number;
		NSString *score;
		
		NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithDictionary:[MainDataArray objectAtIndex:i]];
		name = [d objectForKey:@"theName"];
		comment = [d objectForKey:@"theDesc"];
		score = [NSString stringWithFormat:@"%@ %@", [d objectForKey:@"theScoreType"], [d objectForKey:@"theScore"]];
		int n = i;

		number = [NSString stringWithFormat:@"%i", n];
		//ATOS SPECIFICALLY INDICATES NSDATEFORMATTER LINE BELOW
		NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
		[fmt setDateFormat:@"MMM dd, yyyy"];
		NSDate *date = [fmt dateFromString:[d objectForKey:@"theDate"]];
		
		[fmt release];
		
		[items addObject:[anItem itemNamed:name country:score date:date rowNumber:number]];

		 [d release];
	}

  [delegate loadedDataSource:self];
}
Can anyone see issues here?!?
DrBeak1 is offline   Reply With Quote
Old 09-08-2011, 12:36 PM   #3 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

The only issue that comes to mind for me is if someone has entered in some information as a date, that does not fit format that I have created with NSDateFormatter.

Code:
- (void)loadItemsFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{

	int i;
	
	for (i = 0; i < [MainDataArray count]; i++) {
		NSString *name;
		NSString *comment;
		NSString *number;
		NSString *score;
		
		NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithDictionary:[MainDataArray objectAtIndex:i]];
		name = [d objectForKey:@"theName"];
		comment = [d objectForKey:@"theDesc"];
		score = [NSString stringWithFormat:@"%@ %@", [d objectForKey:@"theScoreType"], [d objectForKey:@"theScore"]];
		int n = i;

		number = [NSString stringWithFormat:@"%i", n];
		//ATOS SPECIFICALLY INDICATES NSDATEFORMATTER LINE BELOW
		NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
		[fmt setDateFormat:@"MMM dd, yyyy"];
		NSDate *date = [fmt dateFromString:[d objectForKey:@"theDate"]];
		
		[fmt release];
		
		[items addObject:[anItem itemNamed:name country:score date:date rowNumber:number]];

		 [d release];
	}

  [delegate loadedDataSource:self];
}
However, it would be impossible for someone to have entered anything other than a date in this format because I use a UIDatePicker to enter this information. The other thing that comes to mind is if there is just too many dates for the "for" method to cycle through (there is no limit on the number of dates the user can enter). If a process takes too long will the app crash? I know this is true during launch, but I am unaware of it being a problem after.

Anyone have any ideas?
DrBeak1 is offline   Reply With Quote
Old 09-08-2011, 02:14 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Don't know the problem, just some thoughts/observations:

1. You are creating a new date formatter in each pass of the loop. Create it one time outside the loop.

2. I don't see where fromDate or toDate are used, which seems curious given the method name. Also don't see where anItem comes from, assume it is a property, and so you should use the accessor methods for it.

3. If the date format fails, then date will be nil. Might be an issue for whatever the itemNamed:country:date:rowNumber: method does.

4. If you are using a date picker, then why is the date stored as a string?

5. What is the point of the n variable? Just use i.

6. What is the point of creating d, either at all or as a mutable dictionary? The data is already a dictionary, so you could just reference it. And I don't see where you are modifying and of its values, so I don't see why it needs to be mutable.

7. Are these methods related in any way? I don't see either one calling the other, so I suspect these may not be the root of your problem.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-08-2011, 02:38 PM   #5 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Thanks, Brian! Excellent observations! I'll take a look deeper into where you've pointed.

Much gratitude : )
DrBeak1 is offline   Reply With Quote
Old 09-08-2011, 06:03 PM   #6 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Per your suggestions, Brian--here is the revised method:
Code:
- (void)loadItemsFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{

	int i;
	
	NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
	[fmt setDateFormat:@"MMM dd, yyyy"];

	for (i = 0; i < [MainDataArray count]; i++) {
		NSString *name;
		NSString *comment;
		NSString *number;
		NSString *score;

		name = [[MainDataArray objectAtIndex:i] objectForKey:@"theName"];

		comment = [[MainDataArray objectAtIndex:i] objectForKey:@"theDesc"];
		score = [NSString stringWithFormat:@"%@ %@", [[MainDataArray objectAtIndex:i] objectForKey:@"theScoreType"], 
				 [[MainDataArray objectAtIndex:i] objectForKey:@"theScore"]];
		
		number = [NSString stringWithFormat:@"%i", i];
		
		NSDate *date = [fmt dateFromString:[[MainDataArray objectAtIndex:i] objectForKey:@"theDate"]];
		
		
		
		[items addObject:[anItem itemNamed:name country:score date:date rowNumber:number]];

	}
	[fmt release];


  [delegate loadedDataSource:self];
}
Regarding:
Quote:
4. If you are using a date picker, then why is the date stored as a string?
-because I set up the app in a dumb way initially. I saved all the date information as strings in the above format. If I hadn't done that the loop would be unnecessary. I'm considering setting up a single use method that runs when the app is launched to reformat this information, remove the loop, and set it up to save all future data as an NSDate.

Quote:
5. What is the point of the n variable? Just use i.
-There is no point, my bad. Thanks!

Quote:
6. What is the point of creating d, either at all or as a mutable dictionary? The data is already a dictionary, so you could just reference it. And I don't see where you are modifying and of its values, so I don't see why it needs to be mutable.
-again, no point. I forgot that when you alloc/init an array all the items in the array follow suit. so, yea--my bad again. Thanks!

Quote:
7. Are these methods related in any way? I don't see either one calling the other, so I suspect these may not be the root of your problem.
-they are both called by KalViewController, which is from the Kalframework, a calendar view that is very much identical to the native iphone calendar. These methods are part of collecting the dates that should be shown when the calendar is launched, and what months and days that exist on either side of that month (i.e., if it loads Sept, it also loads Aug and Oct).

The crash is reported to occur when the user presses the UIButton to load the KalViewController.
DrBeak1 is offline   Reply With Quote
Old 09-08-2011, 07:57 PM   #7 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Proposed changes:

Code:
- (void)loadItemsFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{
   int i;
	
   NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
   [fmt setDateFormat:@"MMM dd, yyyy"];

   for (i = 0; i < [MainDataArray count]; i++) {
      NSString *name;
      NSString *comment;
      NSString *number;
      NSString *score;

      NSDictionary *dictionary = [MainDataArray objectAtIndex:i];

      name = [dictionary objectForKey:@"theName"];

      comment = [dictionary objectForKey:@"theDesc"];
      score = [NSString stringWithFormat:@"%@ %@", [dictionary objectForKey:@"theScoreType"], [dictionary objectForKey:@"theScore"]];
		
      number = [NSString stringWithFormat:@"%i", i];
		
      NSDate *date = [fmt dateFromString:[dictionary objectForKey:@"theDate"]];
		
      [self.items addObject:[self.anItem itemNamed:name country:score date:date rowNumber:number]];

   }
   [fmt release];

   [delegate loadedDataSource:self];
}
Quote:
Originally Posted by DrBeak1 View Post
-they are both called by KalViewController, which is from the Kalframework, a calendar view that is very much identical to the native iphone calendar. These methods are part of collecting the dates that should be shown when the calendar is launched, and what months and days that exist on either side of that month (i.e., if it loads Sept, it also loads Aug and Oct).

The crash is reported to occur when the user presses the UIButton to load the KalViewController.
Well, what I mean is, since you flagged 2 lines from the crash report, generally speaking those kinds of things happen in the situation of A calls B calls C calls D, and something in D crashed, so you see A, B, C, and D in the stack trace. But that doesn't seem to be the case here, since neither of these methods calls the other, and this is all happening on the main thread. Which is why I don't think these methods, or at least not combined, are your problem.

Also, if this is happening in response to a button press that loads this view, then I'm not sure why the touches method would be activated. I'm assuming you mean that the button is in a previous view controller that is then creating this one, so why would anything in this one have been touched yet? But if it is happening in response to a button press, let's have a look at the button's action.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-08-2011, 09:15 PM   #8 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Thanks for your help Brian.

The UIButton call is pretty basic. The only thing that is out of the ordinary is that I intentionally set TheCalendarView to nil every time in order to reload the calendar's data:
Code:
-(IBAction)showCalendar {
	
	calEditBOOL = NO;
	
	theCal = nil;
	TheCalendarView *k = [[TheCalendarView alloc] initWithNibName:@"TheCalendarView" bundle:nil];
	self.theCal = k;
	[k release];

	
	[self.navigationController pushViewController:theCal animated:YES];
	
	
}
Then in TheCalendarView.h:

Code:
@interface TheCalendarView : UIViewController <UINavigationControllerDelegate, UITableViewDelegate> {
	KalViewController *kal;
	id dataSource;
	
	IBOutlet UITableView *kalTable;
	
	NSMutableArray *MainDataArray;

}

#pragma mark PROPERTIES
@property(nonatomic, retain)NSMutableArray *MainDataArray;
@property(nonatomic, retain)id dataSource;
@property(nonatomic, retain)KalViewController *kal;
@end
TheCalendarView.m
Code:
-(void)viewDidLoad {
	[super viewDidLoad];

	self.kal = nil;
	KalViewController *k = [[KalViewController alloc] init];
	self.kal = k;
	[k release];
		
	id ds = [[KalDataSource alloc] init];
	self.dataSource = ds;
	[ds release];
		
	kal.dataSource = dataSource;	
	kal.delegate = self;
	self.view = kal.view;
	
}
And also, just to note anItem is a data object that contains 3 NSStrings and a single NSDate.

Last edited by DrBeak1; 09-08-2011 at 09:35 PM.
DrBeak1 is offline   Reply With Quote
Old 09-09-2011, 10:12 AM   #9 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Your usage of the properties (self.) is not consistent. I'd bet money that this is contributing to your problems.

I don't like that you are replacing self.view in viewDidLoad. Either use loadView instead, or add kal.view as a subview.

And this:

Code:
self.kal = nil;
KalViewController *k = [[KalViewController alloc] init];
self.kal = k;
[k release];
...is unnecessary, since you're about to replace it anyway.

Otherwise, still not seeing the problem. And still not seeing a reason for the touches method to be involved.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-12-2011, 05:16 PM   #10 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

I went through and made the changes you suggested. I also tried just adding kal.view as a subview, but for some reason this caused a crash. Haven't been able to investigate yet but will get back to you about it.

What is the difference between setting self.view = kal.view in viewDidLoad and doing it in loadView? Probably a stupid question and I'm sure there is a good answer--I would love to know why?
DrBeak1 is offline   Reply With Quote
Old 09-12-2011, 06:57 PM   #11 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Well, it's a matter of the purpose of the methods. loadView. Load/create the view. viewDidLoad. The view did load. So why - in the method that is telling you that the view did load - would you replace the view?

What is the crash that happened when you made it a subview?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 12:04 PM   #12 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Aw- makes sense now that you explain it. Thank you.

The crash shows this in the console:
Code:
-[TheCalendarView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance ...

***Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:-[TheCalendarView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance ...
Obviously not the whole console read out -- but this is what is causing the crash. I have no clue why [self.view addSubview:self.kal.view] would cause this crash and self.view = self.kal.view, doesn't.

Still stumped here. And very appreciative of your continued attention : )
DrBeak1 is offline   Reply With Quote
Old 09-13-2011, 12:11 PM   #13 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

There is a table somewhere that is looking at TheCalendarView for delegate methods, and not finding them.

3 possibilities:

1. This is the wrong class, specified accidentally somewhere.
2. This is the wrong class, due to a memory management issue.
3. This is the right class, but it does not implement the methods.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 12:46 PM   #14 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Wow I feel dumb. TheCalendarView did not implement numberOfSectionsInTableView or numberOfRowsInSection. When I was setting self.kal.view as self.view it worked though -- it must be calling these methods from another class when done this way... but when adding it as a subview it needs the methods in TheCalendarView. I'm not sure why this is...

Which do you think is the safest way to execute this? Should I set the view in loadView or add it as a subview?

The only difference I can see is that when I set it as a subview it is placed incorrectly so I'll have to make some adjustments to it's location.
DrBeak1 is offline   Reply With Quote
Old 09-13-2011, 12:48 PM   #15 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Not sure. Seems weird, though. You have ViewControllerA, and ViewControllerB. So in ViewControllerA, why would you take the view from ViewControllerB, and make it the main view in ViewControllerA? What purpose does ViewControllerA serve, then? Why not just use ViewControllerB by itself?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 01:20 PM   #16 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

At first I was calling the calendar view controller from viewControllerA like so:
Code:
-(IBAction)showCalendarview {

self.calendarView = nil; //which is an instance of KalViewController
KalViewController *c = [KalViewController alloc] initWithSelectedDate:[NSDate date]];
self.calendarView = c;
[c release];

id ds = [KalDataSource alloc] init];
self.dataSource = ds;
[ds release];

self.calendarView.dataSource = self.dataSource;
self.calendarView.delegate = self;

[self.navigationController pushViewController:self.calendarView animated:YES];

}
But I thought that the crashing users were experiencing may be caused due to viewControllerA dealloc'ing after it pushed calendarView - thus the delegate for calendarView is dealloc'd.

That is why I created a new viewController-- viewControllerB.

The way I have it set up now is that viewControllerA pushes viewControllerB--> viewControllerB then sets up calendarView in its load methods (i.e., setting the KalDataSource and setting viewControllerB as the delegate) and finally sets calendarView's view as it's own.

I know... strange but I thought that this may be the cause, but obviously not. Users continued to report the crash after I released this change in an update.

The strangest thing about all of this is that it none of these configurations cause a crash on my personal phone or any of my test devices. Furthermore, only 8 users have reported this crash (surly there are more) but the majority of users indicate that the calendar works perfectly for them. I thought it may be an issue of the users using an old version of iOS or old iDevices but after checking in with them the users reporting crashes are using iPhone 4's with the latest version of iOS.

Last edited by DrBeak1; 09-13-2011 at 01:26 PM.
DrBeak1 is offline   Reply With Quote
Old 09-13-2011, 01:25 PM   #17 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

View controllers aren't deallocated when they are still on the navigation stack.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 01:57 PM   #18 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Right, which I thought was true. But again I was stumped (as I continue to be) and this was the only thing that I could find that may be the culprit; the delegate is released before calendarView is finished with it...

So if I go back to doing things how I had them set up initially it will definitely simplify the process but I am still perplexed as to why this crash is occurring : (

It has to be the KalDataSource or another element related to the set up of the KalViewController. But I just cannot see anything of error there.

I know it's a lot but here is the code:
Code:
///KalDataSource.m///

#import "KalDataSource.h"
#import "KalObject.h"

static BOOL IsDateBetweenInclusive(NSDate *date, NSDate *begin, NSDate *end)
{
  return [date compare:begin] != NSOrderedAscending && [date compare:end] != NSOrderedDescending;
}

@interface KalDataSource ()
- (NSArray *)KalObjectsFrom:(NSDate *)fromDate to:(NSDate *)toDate;


@end

@implementation KalDataSource
@synthesize MainDataArray, KalObjects, items1;

+ (KalDataSource *)dataSource
{
  return [[[[self class] alloc] init] autorelease];
}

- (id)init
{
  if ((self = [super init])) {
	  NSMutableArray *i = [[NSMutableArray alloc] init];
	  self.KalObjects = i;
	  [i release];

	  NSMutableArray *a = [[NSMutableArray alloc] init];
	  self.items1 = a;
	  [a release];
	  
	  [self loadArrays];
  }
  return self;
}

- (KALOBJECT *)KalObjectAtIndexPath:(NSIndexPath *)indexPath
{
	NSInteger rows = [indexPath row];
	NSInteger count = [items1 count];
	
  return [items1 objectAtIndex:(count-1-rows)];
}

#pragma mark Load My dataSource
-(void)loadArrays {
	
	
	self.MainDataArray = nil;
	
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSString *documentsDirectory = [paths objectAtIndex:0];
	NSString *filePath = [documentsDirectory stringByAppendingString:@"/MyData.plist"];
	NSArray *load = [NSArray arrayWithContentsOfFile:filePath];
	self.MainDataArray = [NSMutableArray arrayWithArray:load];	
	
}

#pragma mark UITableViewDataSource protocol conformance

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *identifier = @"MyCell";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  if (!cell) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier] autorelease];
    cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
	  cell.selectionStyle = UITableViewCellSelectionStyleNone;

  }
	

	cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  
	KalObject *ko = [self KalObjectAtIndexPath:indexPath];
	
	
	UIView *selectedView = [[[UIView alloc] initWithFrame:CGRectZero]autorelease];
	UIImage *selected = [UIImage imageNamed:@"selectedMask.png"];
	
	selectedView.backgroundColor = [UIColor colorWithPatternImage:selected];
	cell.selectedBackgroundView = selectedView;
	
	
	cell.textLabel.text = ko.name;
	cell.detailTextLabel.text = ko.country;
	
  return cell;
}

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {


	
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  return [items1 count];
}

- (void)loadKalObjectsFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{

	int i;

	NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
	[fmt setDateFormat:@"MMM dd, yyyy"];

	for (i = 0; i < [MainDataArray count]; i++) {
		NSDictionary *dictionary = [MainDataArray objectAtIndex:i];
		NSString *name;
		NSString *comment;
		NSString *number;
		
		NSString *score;

		name = [dictionary objectForKey:@"theName"];

		comment = [dictionary objectForKey:@"theDesc"];
		score = [NSString stringWithFormat:@"%@ %@", [dictionary objectForKey:@"theScoreType"], 
				 [dictionary objectForKey:@"theScore"]];
		
		number = [NSString stringWithFormat:@"%i", i];
		
		NSDate *date = [fmt dateFromString:[dictionary objectForKey:@"theDate"]];
		
		
		
		[self.KalObjects addObject:[KalObject KalObjectNamed:name country:score date:date rowNumber:number]];

	}
	[fmt release];


  [delegate loadedDataSource:self];
}

#pragma mark KalDataSource protocol conformance

- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
{
  [KalObjects removeAllObjects];
  [self loadKalObjectsFrom:fromDate to:toDate delegate:delegate];
}

- (NSArray *)markedDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate
{
  return [[self KalObjectsFrom:fromDate to:toDate] valueForKeyPath:@"date"];
}

- (void)loadItemsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate
{
  [items1 addObjectsFromArray:[self KalObjectsFrom:fromDate to:toDate]];
}

- (void)removeAllItems
{
  [items1 removeAllObjects];
}

#pragma mark -

- (NSArray *)KalObjectsFrom:(NSDate *)fromDate to:(NSDate *)toDate
{
  NSMutableArray *matches = [NSMutableArray array];
  for (KalObject *ko in KalObjects)
    if (IsDateBetweenInclusive(ko.date, fromDate, toDate))
      [matches addObject:ko];
	
	int w  = 0;
	NSMutableArray *ma = [[NSMutableArray alloc] init];
	for (w = 0; w < [matches count]; w++) {
		KalObject *aKalObject = [matches objectAtIndex:w];
		int aNum = [aKalObject.rowNumber intValue];
		[ma addObject:[NSNumber numberWithInt:aNum]];
	}
	[[NSUserDefaults standardUserDefaults] setObject:ma forKey:@"KalObjectNums"];
	[[NSUserDefaults standardUserDefaults] synchronize];

	[ma release];
	
  
  return matches;
}

- (void)dealloc
{
	[MainDataArray release];
	[items1 release];
	[KalObjects release];
	[super dealloc];
}

@end
and...

Code:
///KalObject.m///

#import "KalObject.h"

@implementation KalObject

@synthesize date, name, country, rowNumber;

+ (KalObject*)KalObjectNamed:(NSString *)aName country:(NSString *)aCountry date:(NSDate *)aDate rowNumber:(NSString *)aRow
{
	return [[[KalObject alloc] initWithName:aName country:aCountry date:aDate rowNumber:aRow] autorelease];
}

- (id)initWithName:(NSString *)aName country:(NSString *)aCountry date:(NSDate *)aDate rowNumber:(NSString *)aRow
{
	if ((self = [super init])) {
		name = [aName copy];
		country = [aCountry copy];
		date = [aDate retain];
		rowNumber = [aRow copy];
	}
	return self;
}

- (NSComparisonResult)compare:(KalObject *)otherKalObject
{
	NSComparisonResult comparison = [self.date compare:otherKalObject.date];
	if (comparison == NSOrderedSame)
		return [self.name compare:otherKalObject.name];
	else
		return comparison;
}

- (void)dealloc
{
	[rowNumber release];
	[date release];
	[name release];
	[country release];
	[super dealloc];
}

@end
DrBeak1 is offline   Reply With Quote
Old 09-13-2011, 02:14 PM   #19 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I can't help if all you say is "this crash". What is the crash message?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 02:56 PM   #20 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Oh, sorry.

Again, I am still unclear too; thus my vagueness in my explanation.

I have not been able to cause a crash on my personal phone or test devices, but several users report that upon tapping the UIButton (which I mentioned and posted above) that calls the -(IBAction)showCalendar method my app crashes. In my second post of this thread I show an unsymbolicated version of a crash report I obtained from a user, with the two lines related to the KalViewController symbolicated. They are the only two lines that are related to the calendar at all, the rest are related to other viewControllers totally unrelated to the calendar and to frameworks built-in to iOS.

Again, sorry for the vagueness here, but I hope this helps to clarify a bit.
DrBeak1 is offline   Reply With Quote
Old 09-13-2011, 03:02 PM   #21 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I can't provide any further assistance. I'm seeing enough coding oddities that I can believe there are issues, but I can't really put my finger on it given only what has been shown so far.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-13-2011, 03:11 PM   #22 (permalink)
Registered Candy Bar
 
DrBeak1's Avatar
 
Join Date: Nov 2010
Location: San Jose, CA
Posts: 298
DrBeak1 is on a distinguished road
Default

Understood. Thanks for everything you've contributed thus far. I truly do appreciate it!
DrBeak1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 375
7 members and 368 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0