Backendless Support
 
Solved

Data Service Find Crash (ios, swift, 4.0b8)

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}

span.s1 {font-variant-ligatures: no-common-ligatures}

span.Apple-tab-span {white-space:pre}

  1. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -length cannot be sent to an abstract object of class NSString: Create a concrete instance!'
  2. *** First throw call stack:
  3. (
  4. 0 CoreFoundation 0x000000010bfc1b0b __exceptionPreprocess + 171
  5. 1 libobjc.A.dylib 0x000000010ba26141 objc_exception_throw + 48
  6. 2 CoreFoundation 0x000000010c02a625 +[NSException raise:format:] + 197
  7. 3 Foundation 0x000000010a8e85a3 -[NSString length] + 19
  8. 4 CoreFoundation 0x000000010bf4e288 CFStringReplaceAll + 264
  9. 5 Foundation 0x000000010a7f3c6a -[NSString lowercaseStringWithLocale:] + 47
  10. 6 SafariServices 0x000000010b4210e7 -[NSString(SafariServicesExtras) sf_isFeedScheme] + 27
  11. 7 Foundation 0x000000010a8797dd _NSGetBoolValueWithMethod + 77
  12. 8 Foundation 0x000000010a7ede1d -[NSObject(NSKeyValueCoding) valueForKey:] + 284
  13. 9 Foundation 0x000000010a871a25 -[NSObject(NSKeyValueCoding) dictionaryWithValuesForKeys:] + 168
  14. 10 plusco 0x0000000109dec9f0 -[AnonymousObject setFieldsDirect:cache:] + 71
  15. 11 plusco 0x0000000109dee039 -[AnonymousObject adapt:cache:] + 1290
  16. 12 plusco 0x0000000109ded11e -[AnonymousObject setFieldsDirect:cache:] + 1909
  17. 13 plusco 0x0000000109dee039 -[AnonymousObject adapt:cache:] + 1290
  18. 14 plusco 0x0000000109ddfcbe -[ArrayType defaultAdapt:] + 625
  19. 15 plusco 0x0000000109de00ab -[BodyHolderFactory createObject:] + 114
  20. 16 plusco 0x0000000109decf24 -[AnonymousObject setFieldsDirect:cache:] + 1403
  21. 17 plusco 0x0000000109dee039 -[AnonymousObject adapt:cache:] + 1290
  22. 18 plusco 0x0000000109dcfe17 -[HttpEngine processAsyncAMFResponse:] + 440
  23. 19 libdispatch.dylib 0x000000010f5f94a6 _dispatch_call_block_and_release + 12
  24. 20 libdispatch.dylib 0x000000010f62205c _dispatch_client_callout + 8
  25. 21 libdispatch.dylib 0x000000010f60340b _dispatch_main_queue_callback_4CF + 411
  26. 22 CoreFoundation 0x000000010bf86909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
  27. 23 CoreFoundation 0x000000010bf4cae4 __CFRunLoopRun + 2164
  28. 24 CoreFoundation 0x000000010bf4c016 CFRunLoopRunSpecific + 406
  29. 25 GraphicsServices 0x0000000113474a24 GSEventRunModal + 62
  30. 26 UIKit 0x000000010cace0d4 UIApplicationMain + 159
  31. 27 plusco 0x0000000109d91807 main + 55
  32. 28 libdyld.dylib 0x000000010f66e65d start + 1
  33. )
  34. libc++abi.dylib: terminating with uncaught exception of type NSException

Code which is executed, simple find, with SQLlike query

Its crashing inside backendless SDK lib

  1. SVProgressHUD.show(withStatus: NSLocalizedString("Global_Loading", comment: "Loading..."))
  2. let queryBuilder = DataQueryBuilder()
  3. _ = queryBuilder?.setRelationsDepth(5)
  4. let whereClause = "to.objectId = '\(self.senderId!)' OR to.objectId = '\(notificationHelper.connectTouserId!)' OR from.objectId = '\(self.senderId!)' OR from.objectId = '\(notificationHelper.connectTouserId!)'"
  5. _ = queryBuilder?.setWhereClause(whereClause)
  6. print(whereClause)
  7. Backendless.sharedInstance().data.of(Messages.self).find(queryBuilder, response: { (res:Any?) in
  8. SVProgressHUD.dismiss()
  9. if let data:Array<Messages> = res as? Array<Messages>
  10. {
  11. self.data = data
  12. self.finishReceivingMessage(animated: true)
  13. }
  14. }, error: { (err:Fault?) in
  15. print("Server reported an error: \(err)")
  16. SVProgressHUD.dismiss()
  17. })

Leave a Comment

Comments (6)

photo
1

Hello Tomas,

Please provide your APP_ID so we could check this issue with your application.

Regards, Olga

photo
1

02E0B487-71CE-DB1E-FF7F-79892D128500

photo
1

Hello Tomas,

We can't reproduce this issue with iOS SDK. Could you please share the simple working project which reproduces this error.

Regards, Olga

photo
1

There is no problem with Backendless, relations are not Strings. Just change the from and to properties type.

  1. class Messages : NSObject {

    var message: String?

    var to: BackendlessUser?

    var from: BackendlessUser?

    }

Regards, Olga

photo
1

f word :(