Tan*_*lva 2 objective-c xcode4.4 osx-mountain-lion
我最近在Mountain Lion上运行了Xcode 4.4的新项目.我有一个名为的类TSTopChartManager,它位于我项目的MainMenu笔尖中.我还有一个名为的数据容器PodcastShow,它基本上有一堆属性和一个从互联网上获取图像的方法.这TSTopChartManger看起来像......
.h文件......
#import <Foundation/Foundation.h>
#import "PodcastShow.h"
@interface TSTopChartManager : NSObject
@property NSMutableArray *topPodcasts;
@end
Run Code Online (Sandbox Code Playgroud)
.m文件:
#import "TSTopChartManager.h"
@implementation TSTopChartManager
-(id) init
{
if (self)
{
/*PodcastShow *myShow = [[PodcastShow alloc] init];
myShow.title = @"This is a show";*/
}
return self;
}
@end
Run Code Online (Sandbox Code Playgroud)
现在,它完美运行.但是当我在init方法中删除块注释时就像这样......
if (self)
{
PodcastShow *myShow = [[PodcastShow alloc] init];
myShow.title = @"This is a show";
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误..
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PodcastShow", referenced from:
objc-class-ref in TSTopChartManager.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
我不知道为什么会这样.我以前没见过这样的错误.我该怎么办呢?有任何想法吗?谢谢!
对于好奇:
PodcastShow在我的应用程序中被视为数据容器.它有一些属性和两种方法.这是PodcastShow看起来像:
.H:
#import <Foundation/Foundation.h>
@interface PodcastShow : NSObject
{
NSString *title;
NSString *network;
NSString *imageURL;
NSImage *image;
NSString *link;
NSString *description;
}
-(void) fetch;
@property (strong, readwrite) NSString *title;
@property (strong, readwrite) NSString *network;
@property (strong, readwrite) NSString* imageURL;
@property (strong) NSImage *image;
@property (strong, readwrite) NSString *identification;
@property (strong, readwrite) NSString *link;
@property (strong, readwrite) NSString *description;
@end
Run Code Online (Sandbox Code Playgroud)
L:
#import "PodcastShow.h"
@implementation PodcastShow
-(id) init
{
if (self)
{
NSLog(@"initilized");
}
return self;
}
-(void) fetch
{
[NSThread detachNewThreadSelector:@selector(getImageFromInternet) toTarget:self withObject:nil];
}
-(void) getImageFromInternet
{
self.image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:self.imageURL]];
}
@end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5312 次 |
| 最近记录: |