cylankj / IoTKit-iOS

0 stars 1 forks source link

Application crash with latest SDK #1

Closed KonstantinRitt closed 6 years ago

KonstantinRitt commented 6 years ago

iOS 11.1.2: worked ok on 8f701f8b4b8ec8a3468144ed9dbcc3904f8651d1 the code causing a crash:

[JFGSDK connectWithVid:@"" vKey:@"" ForWorkDir:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"jfg"]];

-[NSPathStore2 jfgUTF8String]: unrecognized selector sent to instance 0x1c4187c50 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSPathStore2 jfgUTF8String]: unrecognized selector sent to instance 0x1c4187c50' First throw call stack: (0x182fc5d04 0x182214528 0x182fd31c8 0x182fcb6b0 0x182eb101c 0x101f48170 0x101f5b438 0x100b4bcd4 0x100b23d04 0x100b15848 0x100aaa090 0x100aaa48c 0x100aac2dc 0x100b57090 0x101985af4 0x101e12abc 0x1019173a0 0x1019185f8 0x1019184d0 0x10193ee68 0x101930fc0 0x1019359f4 0x10188f65c 0x101819400 0x101a14238 0x101987558 0x101987b64 0x1019f0774 0x101951e78 0x101e4febc 0x101e4fde0 0x101aae2b8 0x101a323a8 0x101978710 0x1019772b0 0x1019787a0 0x101977fd8 0x101a220ec 0x101a21e80 0x101a22360 0x100a9726c 0x100b6b738 0x100b6b468) libc++abi.dylib: terminating with uncaught exception of type NSException

BT:

0 0x0000000182add348 in __pthread_kill ()

1 0x0000000182bf1344 in pthread_kill$VARIANT$mp ()

2 0x0000000182a4cfb8 in abort ()

3 0x00000001821ec068 in abort_message ()

4 0x00000001821ec210 in default_terminate_handler() ()

5 0x0000000182214810 in _objc_terminate() ()

6 0x000000018220454c in std::__terminate(void (*)()) ()

7 0x0000000182203ea8 in __cxa_throw ()

8 0x000000018221465c in objc_exception_throw ()

9 0x0000000182fd31c8 in -[NSObject(NSObject) doesNotRecognizeSelector:] ()

10 0x0000000182fcb6b0 in forwarding ()

11 0x0000000182eb101c in _CF_forwarding_prep_0 ()

12 0x0000000102458224 in ::-[JFGSDKBase connectWithVid:vKey:ForWorkDir:](NSString , NSString , NSString *) at /Users/yangli/git/3.0-sdk/src/cylan/sdk/object-c/JFGSDK/JFGSDKSource/JFGSDKBase/JFGSDKBase.mm:175

13 0x000000010246c590 in ::+[JFGSDK connectWithVid:vKey:ForWorkDir:](NSString , NSString , NSString *) at /Users/yangli/git/3.0-sdk/src/cylan/sdk/object-c/JFGSDK/JFGSDKSource/JFGSDKBase/JFGSDK.mm:22

tubzby commented 6 years ago

NSPathStore2 is a subclass of NSString that is used to create strings that contain paths. For all intents and purposes, you should pass in an NSString.

KonstantinRitt commented 6 years ago

And that's exactly what I'm passing to [JFGSDK connectWith]!

The question is: where that unrecognized selector jfgUTF8String of NSPathStore2 cames from?

Step-by-step debugging shows that Vid and vKey are applied successfully at JFGSDK shared instance initialization, then the problem occurs when applying the passed ForWorkDir. Note that I was trying ForWorkDir:@"" as well and that caused exactly the same result.

yangli996 commented 6 years ago

The base of a NSString expansion, used to determine whether the string is nil

yangli996 commented 6 years ago

Please cast the parameters to NSString

KonstantinRitt commented 6 years ago

The connectWith method has 3 NSString parameters. I'm passing 3 NSSting parameters to it. How could casting NSString to NSString solve the issue?!

The code above worked just fine on commit 8f701f8 and doesn't work after that commit.

Plz take a look at /Users/yangli/git/3.0-sdk/src/cylan/sdk/object-c/JFGSDK/JFGSDKSource/JFGSDKBase/JFGSDKBase.mm:175 - find the problem and fix it.

yangli996 commented 6 years ago

NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"jfg"]; [JFGSDK connectWithVid:@"" vKey:@"" ForWorkDir:path];

KonstantinRitt commented 6 years ago

NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"jfg"]; [JFGSDK connectWithVid:@"" vKey:@"" ForWorkDir:path];

0 0x0000000182add348 in __pthread_kill ()

1 0x0000000182bf1344 in pthread_kill$VARIANT$mp ()

2 0x0000000182a4cfb8 in abort ()

3 0x00000001821ec068 in abort_message ()

4 0x00000001821ec210 in default_terminate_handler() ()

5 0x0000000182214810 in _objc_terminate() ()

6 0x000000018220454c in std::__terminate(void (*)()) ()

7 0x0000000182203ea8 in __cxa_throw ()

8 0x000000018221465c in objc_exception_throw ()

9 0x0000000182fd31c8 in -[NSObject(NSObject) doesNotRecognizeSelector:] ()

10 0x0000000182fcb6b0 in forwarding ()

11 0x0000000182eb101c in _CF_forwarding_prep_0 ()

12 0x0000000102458224 in ::-[JFGSDKBase connectWithVid:vKey:ForWorkDir:](NSString , NSString , NSString *) at /Users/yangli/git/3.0-sdk/src/cylan/sdk/object-c/JFGSDK/JFGSDKSource/JFGSDKBase/JFGSDKBase.mm:175

13 0x000000010246c590 in ::+[JFGSDK connectWithVid:vKey:ForWorkDir:](NSString , NSString , NSString *) at /Users/yangli/git/3.0-sdk/src/cylan/sdk/object-c/JFGSDK/JFGSDKSource/JFGSDKBase/JFGSDK.mm:22

KonstantinRitt commented 6 years ago

Is there any other info I can provide that will help you finally understand the problem and fix it?

KonstantinRitt commented 6 years ago

Fixed in 380f2d2ccaeb81649caa138506be4529266a1826, thanks.