Connect Crash

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

gn02082343
Posts: 2
Joined: 14 Oct 2019, 00:52

Connect Crash

Postby gn02082343 » 14 Oct 2019, 00:55

I am just starting to get to grips with ios swift and your objective c api. Are there any simple examples of a swift implementation of the IOS framework showing a connect for example.

I am using Xcode 11.1 and SFS2X Api Objective C 1.7.10 framework and my poject deploymeny target is iOS 9.0.

I'm succesful compiling Shark bridge. At run time I get this crash when try to load confign and connect to my server instance.

Here is my log.

2019-10-09 16:43:02.369590+0800 CC[8742:359238] [SFS - INFO]SFS2X API version: 1.7.10
2019-10-09 16:43:02.369825+0800 CC[8742:359238] +[NSStream qNetworkAdditions_getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class 0x7fff87afa660
2019-10-09 16:43:02.388905+0800 CC[8742:359238] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSStream qNetworkAdditions_getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class 0x7fff87afa660'

*** First throw call stack:
(
0 CoreFoundation 0x00007fff23baa1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50864b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23bcb054 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23baef6c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23bb10f8 _CF_forwarding_prep_0 + 120
5 CC 0x000000010eeadd5b -[BitSwarmClient connect:port:] + 731
6 CC 0x000000010eee3dd2 -[SmartFox2XClient connect:port:] + 642
7 CC 0x000000010ec2a45f $s2CC15SmartFoxManagerC7connectyyF + 239
8 CC 0x000000010ed472e9 $s2CC18LogoViewControllerC16moveToNextScreenyyAA11VCIndicatorOF + 1753
9 CC 0x000000010ed480e5 $s2CC18LogoViewControllerCAA0bC8DelegateA2aDP16moveToNextScreenyyAA11VCIndicatorOFTW + 37
10 CC 0x000000010ed49c00 $s2CC13LogoViewModelC13onHttpSuccessyySSSg_10Foundation4DataVSgSo13NSURLResponseCSgtF + 4192
11 CC 0x000000010ed4fb08 $s2CC13LogoViewModelCAA11HttpHandlerA2aDP02onE7SuccessyySSSg_10Foundation4DataVSgSo13NSURLResponseCSgtFTW + 24
12 CC 0x000000010ecef65d $s2CC11HttpRequestC17completionHandler33_84D632F49969ACF1496C43C03F44F0F8LLyy10Foundation4DataVSg_So13NSURLResponseCSgs5Error_pSgtFyycfU_ + 1661
13 CC 0x000000010ead544d $sIeg_IeyB_TR + 45
14 libdispatch.dylib 0x0000000110643df8 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x0000000110644d6c _dispatch_client_callout + 8
16 libdispatch.dylib 0x0000000110652e24 _dispatch_main_queue_callback_4CF + 1500
17 CoreFoundation 0x00007fff23b0ce49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
18 CoreFoundation 0x00007fff23b07aa9 __CFRunLoopRun + 2329
19 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438
20 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65
21 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621
22 CC 0x000000010ec07fb8 main + 72
23 libdyld.dylib 0x00007fff516ecd29 start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

what should I do next step?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connect Crash

Postby Lapo » 14 Oct 2019, 08:07

Hi,
I am just starting to get to grips with ios swift and your objective c api. Are there any simple examples of a swift implementation of the IOS framework showing a connect for example.

Take a look at this post:
viewtopic.php?p=89944#p89944

As regards the error, is it caused by Objective-C code or Swift code? Can you show us the relevant code causing the error?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connect Crash

Postby Lapo » 14 Oct 2019, 08:26

what should I do next step?

You can try using the connectWithConfig method:

Code: Select all

       sfs = SmartFox2XClient(smartFoxWithDebugMode: true, delegate: self)
        NSLog("Version: %@", (sfs?.version)!)
       
        var config:ConfigData? = ConfigData()
        config?.host = "localhost"
        config?.port = 9933
        config?.setZone("BasicExamples")
       
        sfs?.connect(withConfig: config)


Let us know
Lapo

--

gotoAndPlay()

...addicted to flash games
gn02082343
Posts: 2
Joined: 14 Oct 2019, 00:52

Re: Connect Crash

Postby gn02082343 » 16 Oct 2019, 02:30

Actually, I used the sample code in my project.

I tried many ways to solve this issue. Finally, I add this method in my project
+ (void)getStreamsToHostNamed:(NSString *)hostName port:(NSInteger)port inputStream:(NSInputStream **)inputStreamPtr outputStream:(NSOutputStream **)outputStreamPtr

this method wont be called. but some how if project without this will cause crash
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connect Crash

Postby Lapo » 16 Oct 2019, 07:41

gn02082343 wrote:Actually, I used the sample code in my project.

I tried many ways to solve this issue. Finally, I add this method in my project
+ (void)getStreamsToHostNamed:(NSString *)hostName port:(NSInteger)port inputStream:(NSInputStream **)inputStreamPtr outputStream:(NSOutputStream **)outputStreamPtr

this method wont be called. but some how if project without this will cause crash

I am not following. Where exactly did you add the method?
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connect Crash

Postby Lapo » 16 Oct 2019, 08:01

Also I've tested our code example in XCode 11 and it works just fine, using Objective-C API 1.7.10, deployment target iOS 9.1
So I am not sure how to reproduce this.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 8 guests