Objective c Can';t使用object从另一个类调用方法
我试图使用对象从另一个类调用一个方法。没有出现警告或错误,但未进行呼叫。未将执行转移到指定的方法Objective c Can';t使用object从另一个类调用方法,objective-c,class,object,ios7,methods,Objective C,Class,Object,Ios7,Methods,我试图使用对象从另一个类调用一个方法。没有出现警告或错误,但未进行呼叫。未将执行转移到指定的方法 @interface ePub : NSObject - (void) paginateChapters; @implementation ePub - (void) paginateChapters; { for (int i=0; i<chapterLinks.count; i++) { [self splitAttributedStringTo
@interface ePub : NSObject
- (void) paginateChapters;
@implementation ePub
- (void) paginateChapters;
{
for (int i=0; i<chapterLinks.count; i++)
{
[self splitAttributedStringToPages:[chapterFiles objectAtIndex:i] withChapter:[chaptersAsAttributedStringArray objectAtIndex:i]];
}
}
调用loadedEPub对象上的方法时,该对象为nil。在对象响应方法调用之前,必须初始化对象。此代码应运行NSLog。你还在干什么?发布其余代码。@CrimsonChris,但它不起作用。我设置了断点&执行根本没有移动到方法,那么您没有共享的代码有问题。@CrimsonChris还需要什么??我试过同样的代码,对我来说很好。getProperties中的日志正在控制台中打印。你能试着正确编译吗?好的,非常感谢!!!我已经在viewDidLoad()中初始化了它。但是在调用changeFontSize()方法之前,另一个方法将其设为Nil。我没有检查
@interface ePubRootViewController : UIViewController
{
ePub *loadedEpub;
}
@implementation ePubRootViewController
-(void) viewDidLoad()
{
loadedEpub = [[ePub alloc]init];
}
-(void)releaseData
{
loadedEpub=nil;
}
-(void)changeFontSize:(id)sender
{
[self releaseData];
[loadedEpub paginateChapters];
}