PLUG iOS Guide
Quick Start
Download latest version
In order to use PLUG SDK, the development environment should be set up as follows from XCode.
Add the -ObjC option to Other Linker Flags in Build Settings.
Add the library that is included in the sample project to the project.
SDWebImage
FLAnimatedImage
Login with Naver ID
Add the following library to the Link Binary With Libraries in Build Phases. Set the status of the library to be added to required.
AVKit.framework
AVFoundation.framework
MobileCoreServices.framework
SystemConfiguration.framework
MediaPlayer.framework
AVFoundation.framework
CoreMedia.framework
AssetsLibrary.framework
Security.framework
ImageIO.framework
QuartzCore.framework
WebKit.framework
SafariServices.framework
ReplayKit.framework(set the status of the library to optional)
Add user authority option for Info.plist.
NSCameraUsageDescription
NSPhotoLibraryUsageDescription
3. Initialization
Initialize PLUG SDK according to the language that is being supported, as explained below.
3.1 PLUG SDK initialization (only supports Korean - Naver cafe)
When initializing PLUG SDK that only supports Korean, set the initialization settings like indicated below.
Client ID and Client Secret received when registering an application on the login developer center using a Naver ID
Cafe ID received by opening a Naver cafe
URL scheme entered when registering an application on the login developer center using a Naver ID
Parent view controller where the plugin will be applied
Channel code (set to Korean when only Korean channels are being used)
3.2 PLUG SDK initialization (only supports a foreign language)
When initializing PLUG SDK that only supports foreign languages, set the initialization setting like indicated below.
consumerKey: Consumer key received by opening the community
consumerSecretKey: Consumer secret key received by opening the community
cummunityNo: Community No. received by opening the community
loungeNo: Lounge No. received by opening the lounge
Parent view controller where the plugin will be applied
4. Start PLUG SDK
Run PLUG SDK after initialization is complete.
4.1 presentMainViewController: Method
presentMainViewController: Method is used to start PLUG SDK. The following is an example of using the presentMainViewController: method.
NCSDKManager class NCSDKManager class is used to control PLUG SDK. Refer to “details for main functions,” in PLUG SDK's detailed guide, for details regarding the functions that can be controlled using NCSDKManager class.
4.2 Horizontal mode, vertical mode
PLUG SDK supports both horizontal and vertical modes. The following is an example of running PLUG SDK in horizontal mode.
Use the Naver application when logging in with a Naver ID
Set for additional information, like indicated below, when using a Naver ID to log into the Naver application.
1.Register the URL scheme that you have entered when registering the application for Naver ID login on the project. 2. Set as indicated below to allow the Naver application login when initializing the plugin.
3. When logging in with a Naver ID is complete, set the App delegate as indicated below so that login information can be saved on the PLUG.
4. Add the setting below to the Info.plist file so that the Naver application can be opened.
Default channel language settings
Settings for the default channel, which is the community for each language on the PLUG, is applied with the language that is set on the device. If you wish to change the settings on a default channel to a certain language, use the setChannelCode: method.
The following is an example for setting the default channel to Korean.
Initialization of a PLUG that supports the global community and a domestic Naver cafe
If it supports both the global community and a domestic Naver cafe, initialization should be set on the PLUG that supports the global community and a domestic Naver cafe.
Files and Folders
Folder and file name | Description |
guide/ | Folder where the PLUG SDK guide is located |
lib/ | Folder where the iOS PLUG SDK library file is located |
sample/external-lib | Folder where the external library file is located |
sample/navercafesdk-sample-ios | Folder where the Xcode sample project is located |
LICENSE | License file |
README.md | Readme file |
Dependent Libraries
In order to use PLUG SDK, the library should be added to the project to be built. The library is included in the sample project. Naver ID login (4.0.7 version)
AFNetworking(3.1.0 version)
Both the AFNetworking 2.x and 3.x versions can be used. PLUG SDK test has been carried out on AFNetworking 3.1.0 version.SDWebImage(3.8.2 version)
FLAnimatedImage-(1.0.12 version)
ApiGateway-1.5.0
Start / Close PLUG
Start or close the PLUG while a certain tab is selected.
presentMainViewController: Method
Run the PLUG.
The following is an example of using the presentMainViewController: method.
presentMainViewControllerWithTabIndex: Method
Start the PLUG while a certain tab is selected.
The following is an example of using the presentMainViewControllerWithTabIndex: method.
presentMainViewControllerWithArticleId: Method
Start the PLUG while a certain post is shown in the bulletin board tab.
The following is an example of using the presentMainViewControllerWithArticleId: method.
presentArticlePostViewControllerWithType: Method
Start the PLUG by writing a post on a bulletin board screen with an image or video file attached.
The following is an example of using the presentArticlePostViewControllerWithType: method.
dismissMainViewController: Method
Close the PLUG.
The following is an example of using the dismissMainViewController: method.
Horizontal mode, vertical mode
The PLUG supports both horizontal and vertical modes.
The following is an example of using the horizontal mode on the PLUG.
The following is an example of using the vertical mode on the PLUG.
Adjust transparency
If you adjust transparency using the adjustment slider on the upper left side of the PLUG screen, you can use the game and the cafe at the same time.
transparency | Description |
Alpha value 100% | deliver touch events to the PLUG |
Alpha value 100% below | deliver touch events to the game |
You can enable the transparency adjustment slider using the disableTransparentSlider: method.
If you set YES as the disable parameter value, you can use the transparency adjustment slider (default value: YES).
The following is an example of using the transparency adjustment slider.
The following is an example of not using the transparency adjustment slider.
Widget
A widget is an element that is automatically displayed on the screen when the fold button is pressed on the PLUG. You can use the PLUG anywhere in the game by using a widget.
Widget display
You can set the showWidgetWhenUnloadSDK properties for displaying the widget when the fold button is pressed on the PLUG.
If you set the showWidgetWhenUnloadSDK property value as YES, the widget will be displayed when the PLUG window is folded (default value: YES).
The following is an example of displaying the widget.
Run widget
In order to run the widget, use the startWidget: method.
The following is an example of running the widget.
Close widget
To close the widget: use the stopWidget: method.
Default position settings for the widget
When the widget is first run, it is displayed on the center-left part of the screen. If you wish to set the default position setting when the widget is first run, use the setWidgetStartPosition: method and andY: method.
However, when the widget is run again after the user has moved the widget, the widget will be displayed in the position where the user last moved it.
The following is an example for setting the widget's default position to 20% from top, on the right side of the screen.
Screen capture
You can capture the game screen by pressing the screen capture button on the widget.
Screen capture button
The screen capture function is applied using the ncSDKWidgetPostArticleWithImage method.
The following is an example of registering a delegate to call for the ncSDKWidgetPostArticleWithImage method when users press the screen capture button on the widget.
Screen capture settings
You can set the useWidgetScreenShot properties to enable the screen capture function.
If you set the useWidgetScreenShot properties value as YES, the screen capture button will be displayed on the widget (default value: YES).
Video recording
If you press the video recording button on the widget, you can record the game screen.
Video recording settings
You can set the useWidgetVideoRecord properties to enable the video recording function.
If you set the use parameter value as YES, the video recording button will be displayed on the widget (default value: NO).
End recording processing
Tasks that should be processed when video recording has ended are carried out with the ncSDKWidgetSuccessVideoRecord method.
The following is an example of registering a delegate to call the ncSDKWidgetSuccessVideoRecord method when users press the video recording button to end video recording.
Video recording
If you press the video recording button, you can record the game screen while playing the game.
Video recording functionality is supported on iOS 9.0 or above.
Use the video recording function on the widget
If you press the video recording button on the widget, you can record the game screen while playing the game.
You can set the useWidgetVideoRecord properties to enable the video recording function.
If you set the use parameter value as YES, the video recording button will be displayed on the widget (default value: NO).
The video recording button is not displayed on widgets on devices using iOS 9.0 or below, even if you set the useWidgetVideoRecord properties value as YES.
The following is an example of using the video recording function.
Recording ended delegate
Tasks that should be processed when video recording has ended are carried out with the ncSDKWidgetSuccessVideoRecord method.
The following is an example of registering a delegate to call the ncSDKWidgetSuccessVideoRecord method when users press the video recording button to end video recording.
Use the video recording function on the game
You can run the video recording button from the game developer to record the game screen.
The code for starting / ending video recording is included in the NCSDKRecordManager.h file.
Start / Stop video recording
Use the startRecord method to start video recording.
Use the stopRecord method to end video recording.
Video recording delegate
The callback delegate that processes events that have occurred while using the game developer's video recording button is described below.
App scheme processing
When you press the banner image that is displayed on the home screen of the game PLUG, you can go to the App scheme to run game functions.
You can register the banner image for moving to the App scheme from the cafe management menu.
When a pressing banner image that goes to the App scheme, run the openURL: method on the App delegate to process the App scheme like indicated below.
The following is an example of using a listener to process the App scheme.
Callback delegate
Set a callback delegate to process events that have occurred in the PLUG.
Register a callback delegate
Register a view controller that registers the callback delegate in the NCSDKManager class.
Use a callback delegate
The method that is called using a callback delegate when an event has occurred in the PLUG is indicated below.
Game ID linkage
By linking the user’s game ID and cafe ID, they can be managed. You can check for the list of linked game ID and cafe IDs from cafe management menu.
In order to link a game ID and cafe ID, the syncGameUserId() method should be used.
The following is an example of linking the game ID and cafe ID.
Change theme color
You can change the theme color of the PLUG.
In order to change the theme color, use the setThemeColor: method and TabBackgroundColor: method.
themeColorCSSString: The default color that is used on the theme (default value: #00c73c)
backgroundCSSString: the background color for the tab menu (default value: #44484e). It is recommended that you use the default value.
Caution Do not apply alpha values for the CSS color value.
Correct example: #ff9800
Incorrect example: #e2ff9800
The following is an example of changing the theme color.
Change resource image
The resource image that is included in Naver cafe PLUG library can be changed as indicated below.
Change the image in the NaverCafeSDK.bundle package to the desired image.
Apply the new package to the Naver cafe PLUG library and build the project.
Caution When changing the image, the new image's size should be identical with the previous image.
Last updated