点textField调用选择器时,ip5没问题,ip5s,ip6就闪退

iOS 码拜 9年前 (2015-10-18) 822次浏览
– (id)initWithDelegate:(id <CommonDataSelectorDelegate>)delegate andDatasource:(id <CommonDataSelectorDatasource>)datasource

{

     self = [[[NSBundle mainBundle] loadNibNamed:@”CommonDataSelector” owner:self options:nil] objectAtIndex:0] ;

    if (self) {

        self.delegate = delegate;

        self.datasource = datasource;

        self.dataPicker.dataSource = self;//zxxcb 1

        self.dataPicker.delegate = self;

        data= [self.datasource commonSelectorData:self];

        if( [data count]>0)

            self.currentValue=[data objectAtIndex:0];

    }

    return self;

}

在zxxcb 1处抛出的异常,而调用另一个同样方法写的选择器(数据不同)却没有问题。加上标题中的ip5模拟没问题,ip5s,ip6就闪退,这是怎么回事?

解决方案:20分
你这个初始化方法是初始化什么?

你从nib文件加载了一个视图,这个应该是初始化一个uiview

那么uiview的又设置了datasource有点奇怪,crash应该是在这一行才对
data= [self.datasource commonSelectorData:self];

这句又是怎么个回事?data没有定义可以直接用的吗?
另外你应该把crash时的日志贴出来


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明点textField调用选择器时,ip5没问题,ip5s,ip6就闪退
喜欢 (0)
[1034331897@qq.com]
分享 (0)