This article describes how to reference the SDK and initialize it.
The relevant code in this article can be viewed in the file WhiteBaseViewController
of the Demo project.
#import <UIKit/UIKit.h>
#import <WhiteSDK.h>
@interface WhiteBaseViewController: UIViewController
@property (nonatomic, strong) WhiteBoardView *boardView;
@property (nonatomic, strong) WhiteSDK *sdk;
#pragma mark-CallbackDelegate
@property (nonatomic, weak, nullable) id<WhiteCommonCallbackDelegate> commonDelegate;
@end
Create WhiteBoardView
and WhiteSDK
, create instance classes needed by SDK in ViewDidLoad
.
#import "WhiteBaseViewController.h"
#import <Masonry/Masonry.h>
@interface WhiteBaseViewController ()<WhiteCommonCallbackDelegate>
@end
@implementation WhiteBaseViewController
...
-(void)initSDK
{
// 4. Initialize the SDK configuration class and set the configuration according to your needs
WhiteSdkConfiguration *config = [[WhiteSdkConfiguration alloc] initWithApp:@"App Identifier to be filled in"];
// 5. Initialize WhiteSDK and pass in callback, you can view the callback implementation in Example
self.sdk = [[WhiteSDK alloc] initWithWhiteBoardView:self.boardView config:config commonCallbackDelegate:self.commonDelegate];
}
@end
- Please ensure that the incoming WhiteBoardView has been added to the view stack of the ViewController when initializing the SDK.
- Otherwise, iOS 12 will not initialize properly, and there will be no error feedback.
- WhiteBoardView contains UIScrollView instances inside.
- In some ViewControllers of NavigationController, if it is not set correctly, an exception will occur.
- iOS 11 and above, sdk already supports it.
- For iOS10 and below, when you need to call, set the ViewController. Refer to the initialization code.