I am quite puzzled why this warning pops up. I use the same procedure on other controllers where it works perfectly.
ConditionTableViewController.m:57: warning: passing argument 1 of 'initWithCondition:' makes integer from pointer without a cast
With the following code
- (void)managedObjectSelected:(NSManagedObject *)managedObject
{
// Load View
Condition *con = (Condition *)managedObject;
ConditionDetailViewController *detail = [[ConditionDetailViewController alloc] initWithCondition:con];
detail.title = [[managedObject valueForKey:@"cave"] valueForKey:@"title"];
self.navigationItem.backBarButtonItem =
[[[UIBarButtonItem alloc] initWithTitle:@"Back"
style: UIBarButtonItemStyleBordered
target:nil
action:nil] autorelease];
[self.navigationController pushViewController:detail animated:YES];
[detail release];
}
In ConditionDetailViewController.h
- (id)initWithCondition:(Condition *)aCondition开发者_Python百科;
Here the console output of "con"
2011-07-26 11:03:08.485 CaveConditions[10631:f203] <NSManagedObject: 0xe6628e0> (entity: Condition; id: 0xe6608b0 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Condition/p149> ; data: {
cave = "0x67486e0 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Cave/p7>";
ccId = 678;
comment = "";
diveDate = 1286830059;
flow = "0xe668270 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Flow/p1>";
imageURL = "orbe_doof.jpg";
insertDate = nil;
ip = "xxx.xxx.xxx.xxx";
line = "0xe668280 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Line/p1>";
percolation = "0xe668290 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Percolation/p5>";
sediment = "0xe6682a0 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Sediment/p2>";
temperature = 13;
userMail = "xxx@xxx.ch";
username = "Hans K...";
visibility = "0xe6682b0 <x-coredata://368AFBD3-2C66-4ED7-977D-AB8EED8BB577/Visibility/p7>";
})
Includes as requested
ConditionTableViewController.h
#import "CellTableViewController.h"
#import "Cave.h"
ConditionTableViewController.m (Where the managedObjectSelected method gets called)
#import "ConditionTableViewController.h"
#import "ConditionDetailViewController.h"
ConditionDetailViewController.h
#import <UIKit/UIKit.h>
#import "Condition.h"
#import <QuartzCore/QuartzCore.h>
ConditionDetailViewController.m
#import "ConditionDetailViewController.h"
#import "DataProcessor.h"
#import "PhotoViewController.h"
initWithCondition:
is a method of the NSConditionLock
class in the Foundation framework that takes an integer. I think Xcode has somehow confused the symbol names initWithCondition:
from two classes, and is using the wrong version. If your code is correct, including importing the correct headers in every file, it's probably a faulty index or precompiled header. Try deleting the derived data for the project from the "Projects" section of the "Organizer" window, and rebuilding the project.
精彩评论