简体   繁体   English

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[NSNull长度]:无法识别的选择器已发送到实例

[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance

when I try to load a related field, I get this error: "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance" 当我尝试加载相关字段时,出现以下错误:“ ***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[NSNull长度]:无法识别的选择器已发送至实例”

I feel like it's caused by loading a collection of data that the compiler doesn't know what to do with. 我觉得这是由于加载了编译器不知道如何处理的数据集合引起的。

Any help appreciated. 任何帮助表示赞赏。

    func findPostsInGroup() {


    let whereClause = "GroupPostBelongsTo.objectId = 'B52F6BEA-79F8-A58B-FF15-AF840BCB2A00'"
    let dataQuery = BackendlessDataQuery()
    dataQuery.whereClause = whereClause
    print("hey")

    var error: Fault?
    let posts = self.backendless.persistenceService.find(Posts.ofClass(),
        dataQuery:dataQuery) as BackendlessCollection
     print("hey")

    if error == nil {
        for post in posts.data as! [Posts] {
            print("post class is \(post.PostText)")
            print("post class is \(post.objectId)")
            print(post.Author.name)


        }

    }

    else {
        print("Server reported an error: \(error)")
    }

}

import Foundation

Groups table class definition 组表类定义

    class Groups : NSObject{

    var groupName: String?
    var UsersInGroup = [BackendlessUser]()
    var ownerId: String?
    var objectId : String?

} }

Yup, the post.Author.name was empty. 是的,post.Author.name为空。 Making sure it wasn't by adding a value for it fixed that. 确保不是通过添加一个值来解决该问题。 Thank you. 谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSCFArray length]:无法识别的选择器已发送到实例 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray length]: unrecognized selector sent to instance 由于未捕获的异常'NSInvalidArgumentException'无法识别的选择器发送到实例而终止应用程序 - Terminating app due to uncaught exception 'NSInvalidArgumentException' unrecognized selector sent to instance 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSArrayM objectForKey:]:无法识别的选择器已发送至实例 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance ***由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序,原因:“-[__ NSDictionaryM名称]:无法识别的选择器已发送到实例 - *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM Name]: unrecognized selector sent to instance 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:-[__ NSCFString方案]:无法识别的选择器已发送到实例 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[__NSCFString scheme]: unrecognized selector sent to instance 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSCFType next]:无法识别的选择器已发送至实例' - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType next]: unrecognized selector sent to instance ' 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSCFString size]:无法识别的选择器已发送到实例 - Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString size]: unrecognized selector sent to instance 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[NSNull _fastCStringContents:]:无法识别的选择器 - Terminating app due to uncaught exception 'NSInvalidArgumentException' , reason: '-[NSNull _fastCStringContents:]: unrecognized selector NSInvalidArgumentException',原因:'-[NSNull 长度]:无法识别的选择器发送到实例 - NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance iOS-由于未捕获的异常'NSInvalidArgumentException无法识别的选择器发送到实例0x7a9a2c0'而终止应用程序 - IOS - Terminating app due to uncaught exception 'NSInvalidArgumentException unrecognized selector sent to instance 0x7a9a2c0'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM