Ios 应用程序在iPhone 5s上运行时崩溃,但在模拟器上运行时工作

Ios 应用程序在iPhone 5s上运行时崩溃,但在模拟器上运行时工作,ios,xcode,sigabrt,Ios,Xcode,Sigabrt,我有一个从网站获取信息并在表视图中显示的代码。 这是我的密码 if ([event.eventDescription containsString:@"src="]) { NSError *error = nil; NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error]; [detector enumerateMatche

我有一个从网站获取信息并在表视图中显示的代码。 这是我的密码

  if ([event.eventDescription containsString:@"src="]) {

  NSError *error = nil;
  NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];

  [detector enumerateMatchesInString:event.eventDescription
  options:0
  range:NSMakeRange(0, event.eventDescription.length)
  usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop)
  {
    if (result.resultType == NSTextCheckingTypeLink)
    {
      NSString *str = [NSString stringWithFormat:@"%@",result.URL];
      NSLog(@"Image Url = %@",str);
      event.stringImageURL = str;
    }
  }];

 }
当我在iPhone刺激器上运行这段代码时,它工作得非常好。然而,当在我的iPhone上运行它时,它崩溃了。它显示了此
event.stringImageURL=str处的SIGABRT错误代码行。谁能帮帮我吗

编辑: 这显示在我的日志上

-[Events setStringImageURL:]: unrecognized selector sent to instance 0x17002bd40
2015-03-20 09:22:54.047 PforSST1[346:22070] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Events setStringImageURL:]: unrecognized selector sent to instance 0x17002bd40'
*** First throw call stack:
(0x1860ee530 0x1970780e4 0x1860f55f4 0x1860f23ac 0x185ff6c4c 0x100093498 0x187069f34 0x100093114 0x10011cfd4 0x10011cf94 0x100121c28 0x1860a62ec 0x1860a4394 0x185fd11f4 0x18f3fb6fc 0x18a96210c 0x100094a70 0x1976f6a08)
libc++abi.dylib: terminating with uncaught exception of type NSException
这是我的活动

@interface Events : NSObject

@property (nonatomic, strong) NSString *eventName;
@property (nonatomic, strong) NSString *eventDescription;
@property (nonatomic, strong) NSString *stringImageURL;

@end
这是我的活动

- (NSComparisonResult)compare:(Events *)otherObject
{
    return [self.eventName compare:otherObject.eventName];
}

我认为问题在于您的事件。stringImageURL不是字符串类型,将字符串分配给它会导致崩溃。请删除问题中所有不相关的代码,并使问题部分更易于查看。请显示
事件
类,并从您的帖子中删除不必要的代码,这样我们就不必阅读日志代码墙.my event.stringImageURL是一个
NSString
检查以下内容:u是否已合成属性,是否已分配内存?最后使用NSMutableString代替。这应该行得通。