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