[NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

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

Moderators: Lapo, Bax

mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

[NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby mmilen » 07 Oct 2018, 14:17

Hi ,

I'm running into trouble with XCode 10. My Shark Bridge App for iOS runs great when build with XCode 9, but with XCode 10 I get this error : [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

I'm using the latest SartFOx 2X and the latest Objective-C API.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby Lapo » 08 Oct 2018, 09:13

Hi,
we have not tested XCode 10 yet. We'll setup a machine and check it out.
In any case it looks like that NSStream method has been removed from the OS. It's marked as deprecated in the docs though there's no indication for an alternative.

I'll post our progresses after we have investigated.
Thanks for the feedback.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby Lapo » 08 Oct 2018, 14:32

UPDATE:
after some digging in the Apple docs we've found a possible solution that should work for all platforms.
Since we don't have a machine ready with High Sierra/Mojave + XCode 10 it would be probably quicker if you could test it.

Meanwhile we'll set up a proper environment to prepare the final release.
If you want to test it out quickly, drop us an email to our support@... mail address with a reference to this thread.

Hope it helps.
Lapo

--

gotoAndPlay()

...addicted to flash games
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby mmilen » 09 Oct 2018, 21:21

After installing Additional Tools for XCode 10.1 Beta 2 from Sept 27th, all is working well. I'm on High Sierra. Apple had broken a number of 3rd party frameworks with the initial release of XCode 10.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby Lapo » 10 Oct 2018, 07:50

That's interesting. I tested under XCode 10.0 and had the same problem.
It seems to be connected with the deprecation of the method you have mentioned, though the apple doc doesn't say anything about the method being removed.

So they probably just messed it up. In any case we've now implemented a solution that doesn't depend on the deprecated method and works on XCode 10.0 as well.
We'll release it in the next few days.

Cheers
Lapo

--

gotoAndPlay()

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

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby Lapo » 12 Oct 2018, 13:53

The API 1.7.6 has been released:
https://www.smartfoxserver.com/download/sfs2x#p=client

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
zheng
Posts: 2
Joined: 09 Jan 2020, 09:49

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby zheng » 09 Jan 2020, 10:00

i use your demo like this:

Code: Select all

class SFSTestScene: BaseViewController, ISFSEvents {

    var sfs:SmartFox2XClient?
   
    override func viewDidLoad() {
        super.viewDidLoad()
       
       
        sfs = SmartFox2XClient(smartFoxWithDebugMode: true, delegate: self)
              NSLog("Version: %@", (sfs?.version)!)
        sfs?.logger.loggingLevel = LogLevel_DEBUG

        sfs?.connect("121.41.41.189", port: 9873)
    }
   
    func onConnection(_ evt: SFSEvent!)
       {
         
           let data:NSDictionary = evt.params as NSDictionary
           let success:Bool = data.object(forKey: "success") as! Bool
         
           if (success)
           {
               NSLog("Connection OK")
             
               // Send login
               sfs!.send(LoginRequest(userName: "", password: "", zoneName: "Games", params: nil))
           }
             
           else
           {
               NSLog("Connection failed")
           }
         
       }
     
       func onLogin(_ evt: SFSEvent!)
       {
           NSLog("Logged in as: %@", (sfs?.mySelf.name())!)
       }
     
       func onLoginError(_ evt: SFSEvent!)
       {
           let params:NSDictionary = evt.params as NSDictionary

           let errMess:String = params.object(forKey: "errorMessage") as! String
           NSLog("Login ERROR:", errMess)
       }
}



but have a crash: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class 0x10b078488

*** First throw call stack:
(
0 CoreFoundation 0x000000010adad02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x000000010a79db20 objc_exception_throw + 48
2 CoreFoundation 0x000000010adcde94 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010adb1dac ___forwarding___ + 1436
4 CoreFoundation 0x000000010adb3f38 _CF_forwarding_prep_0 + 120
5 FlashWhale 0x0000000108f5b02b -[BitSwarmClient connect:port:] + 731
6 FlashWhale 0x0000000108f91b3b -[SmartFox2XClient connect:port:] + 699
7 FlashWhale 0x0000000108f3aa2e $s10FlashWhale12SFSTestSceneC11viewDidLoadyyF + 1278
8 FlashWhale 0x0000000108f3acdb $s10FlashWhale12SFSTestSceneC11viewDidLoadyyFTo + 43
9 UIKitCore 0x000000011014cb25 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
10 UIKitCore 0x0000000110151a7e -[UIViewController loadViewIfRequired] + 1084
11 UIKitCore 0x00000001100b5b6c -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 160
12 UIKitCore 0x00000001100b5e6c -[UINavigationController _startTransition:fromViewController:toViewController:] + 140
13 UIKitCore 0x00000001100b6d36 -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
14 UIKitCore 0x00000001100b80a1 -[UINavigationController __viewWillLayoutSubviews] + 150
15 UIKitCore 0x0000000110098ed7 -[UILayoutContainerView layoutSubviews] + 217
16 UIKitCore 0x0000000110cb3d01 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
17 QuartzCore 0x0000000109e5dd41 -[CALayer layoutSublayers] + 255
18 QuartzCore 0x0000000109e63f33 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
19 QuartzCore 0x0000000109e6f86a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
20 QuartzCore 0x0000000109db67c8 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
21 QuartzCore 0x0000000109debad1 _ZN2CA11Transaction6commitEv + 643
22 QuartzCore 0x0000000109dec43a _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76
23 CoreFoundation 0x000000010ad0f617 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24 CoreFoundation 0x000000010ad0a0ae __CFRunLoopDoObservers + 430
25 CoreFoundation 0x000000010ad0a72a __CFRunLoopRun + 1514
26 CoreFoundation 0x000000010ad09e16 CFRunLoopRunSpecific + 438
27 GraphicsServices 0x00000001149d6bb0 GSEventRunModal + 65
28 UIKitCore 0x00000001107ceb48 UIApplicationMain + 1621
29 FlashWhale 0x0000000108f3f0eb main + 75
30 libdyld.dylib 0x000000010cc5bc25 start + 1
)


i used swift5.0.1 ,xcode version 11.2.1

help me,, thanks
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [NSStream getStreamsToHostNamed:port:inputStream:outputStream:]: unrecognized selector sent to class

Postby Lapo » 09 Jan 2020, 16:40

Hi,
what SFS2X API version are you using?
Also have you followed the steps here?
http://docs2x.smartfoxserver.com/Gettin ... t-api-objc
Scroll the page at the bottom and check the steps under the Notes on developing with Swift section.

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 5 guests