Adding SDK
To use the Smartech SDK into your project you can have 2 approaches:
- Adding the SDK via Cocoapod (Recommended)
- Manually adding the NetCorePush.framework
Adding the SDK via Cocoapod (Recommended)
ProTip
- The most convenient way to use Smartech SDK in your iOS project is with CocoaPods, which is a dependency manager for Swift and Objective-C projects.
- Always commit your code before you add any new frameworks.
- For more details visit the official docs here.
- To install CocoaPods in your system, run the below command in your terminal.
sudo gem install cocoapods
- If you’re using CocoaPods first time, run the below command in your terminal to create a local CocoaPods spec mirror, else you can go to step 4.
pod setup
- Close your Xcode project and navigate to the project’s root directory and initialize the CocoaPods by running the below command, this will create a new file named Podfile which will be used to manage your project dependency.
pod init
- Now open the
Podfile
in your preferred text editor or run the below command which will open in your default text editor.
open Podfile
- In the
Podfile
you need to add theNetcore-Smartech-iOS-SDK
dependency for all targets.
pod 'Netcore-Smartech-iOS-SDK', '2.4.8'
- Add this line above the app target and below the platform.
source 'https://cdn.cocoapods.org/'
source 'https://github.com/NetcoreSolutions/Specs.git'
- The complete
Podfile
can be found below. (Your Podfile may be different as we have only added one dependency).
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
source 'https://cdn.cocoapods.org/'
source 'https://github.com/NetcoreSolutions/Specs.git'
#app target
target 'YourAppTarget' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for YourAppTarget
pod 'Netcore-Smartech-iOS-SDK', '2.4.7'
end
#content extension target
target 'YourContentExtensionTarget' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for 'YourContentExtensionTarget'
pod 'Netcore-Smartech-iOS-SDK', '2.4.7'
end
#service extension target
target 'YourServiceExtensionTarget' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
# Pods for 'YourServiceExtensionTarget'
pod 'Netcore-Smartech-iOS-SDK', '2.4.7'
end
ProTip
Always specify the platform version on which you plan to target the app deployment. (Here in the example we have
platform :ios, '9.0'
)
- Run the following command to install the Smartech SDK
pod install
Once your installation is complete, you will have to open the workspace file (YOUR-PROJECT-NAME.xcworkspace) that is created.
You can refer the below video for detailed steps for adding the framework via CocoaPods. If you are unable to view the video then you can download the steps in PDF format from here.
Note:
If you want to update only a pod you can use the following command:
pod update POD_NAMEAnd if want to update a pod to a specific version then you need to mention the version of that pod in the Podfile besides pod name, example:
pod 'POD_NAME', '1.1'
and then you can use the update command mentioned above to update that pod to the mentioned version.
Manually adding the NetCorePush.framework
Following are the steps you need to perform to add framework manually:
- You can download the Smartech SDK from our GitHub repository or GitHub Master Direct Link.
- Unzip the downloaded file.
- Search for the framework folder and right-click on it.
- Click on the Add Files to ‘Project Name’ in the list...
- Navigate to the folder where NetCorePush.framework is located.
- Select All three targets.
- Click on the Add Option.
- Click on the ‘+’ button under Development Assets, this section is below Frameworks, Libraries, and Embedded Content.
- Search for NetCorePush.framwork, select it and click on Add.
You can refer to the PDF for detailed steps for manually adding the framework in your project.
Updated almost 4 years ago