我对CoreData有一点该死的问题.我想插入一个新的Object,所以我首先要创建一个.这是由该代码完成的:
Challenges *newChallenge = [[Challenges alloc] init];
[newChallenge setName:@"TestChallenge"];
[newChallenge setRounds:[[NSNumber alloc] initWithInt:12]];
[newChallenge setShots:[[NSNumber alloc] initWithInt:5]];
[newChallenge setDate:[NSDate date]];
Run Code Online (Sandbox Code Playgroud)
但是在alloc init之后我得到了这个错误:
CoreData: error: Failed to call designated initializer on NSManagedObject class 'Challenges'
Run Code Online (Sandbox Code Playgroud)
黑客出了什么问题?
我只是想在我的Map中添加一条Polyline,它显示在tableviewcell中.不幸的是,委托方法没有被调用...如果有人知道为什么会很好.
我的tableview.h:
#import <UIKit/UIKit.h>
#import "Route.h"
#import <MapKit/MapKit.h>
#import <QuartzCore/QuartzCore.h>
@interface RoutesDetailView : UITableViewController<MKMapViewDelegate>{
Route *myRoute;
MKMapView *mapView;
// the view we create for the line on the map
MKPolylineView* _routeLineView;
// the rect that bounds the loaded points
MKMapRect _routeRect;
MKPolyline* _routeLine;
}
@property (nonatomic, retain) Route *myRoute;
@property (nonatomic,retain) MKMapView *mapView;
@property (nonatomic, retain) MKPolyline* routeLine;
@property (nonatomic, retain) MKPolylineView* routeLineView;
-(MKPolyline *) loadRoute: (Route *) theRoute;
@end
Run Code Online (Sandbox Code Playgroud)
我的tableview.m:
@implementation RoutesDetailView
@synthesize myRoute,mapView;
@synthesize routeLine = _routeLine;
@synthesize …Run Code Online (Sandbox Code Playgroud)