Developer Terms and Conditions › The Development › iOS development › Login Session failed › Reply To: Login Session failed
November 18, 2016 at 2:29 pm
#43529
ul
Participant
Hi Ayelet,
Thank you for pointing out about code in AppDelegate.m.
I manage to make it work, however not in pure Swift code, but I had to write objective-C wrapper.
For those who struggle with same problem in Swift:
1. Add new File -> Cocoa Class -> Name Your Class (Mine is “Wrapper”), Subsclass: NSObject, Language: Objective-C -> allow Birgde-Header to be added.
2. Add Method to your Objective-C .m and .h file, for Example -(void)test;
3. Copy following code to newly created method in Objective-C to .m file:
[[CPScioCloud sharedInstance] setCliend_id:@”4b5ac28b-28f9-4695-b784-b7665dfe3763″];
[[CPScioCloud sharedInstance] setEnableLogs:YES];
[[CPScioDevice sharedInstance] setEnableLogs:YES];
This code is from SampleApp
4. Go to your Bidging-Header file, and add #import “Name Your Class.h” (mine is: #import “Wrapper.h”)
4a. Also add #import <ScioSDK/ScioSDK.h> on top of your .h file
5. Go to your AppDelegate.swift, add the following code to func application: UIAplication, did FinishLaunchingWithOption… it is the first method in this file:var someName = Wrapper();
someName.MethodName(); (mine is: someName.test();)
4. Go to your Bidging-Header file, and add #import “Name Your Class.h” (mine is: #import “Wrapper.h”)
4a. Also add #import <ScioSDK/ScioSDK.h> on top of your .h file
5. Go to your AppDelegate.swift, add the following code to func application: UIAplication, did FinishLaunchingWithOption… it is the first method in this file:var someName = Wrapper();
someName.MethodName(); (mine is: someName.test();)
6. Run the App, don’t forget to turn Wifi on, on your iPhone/iPod.
and Voila it should work.