Tutorial - C2Call iOS SDK - C2Call SDK Reference

28 downloads 195 Views 2MB Size Report
Tutorial. Make Your Own Simple Dialer App Using C2Call SDK ... 7. Open a sample project for example “Simple CallAPI Sample.xcodeproj” to copy the required ...
                 

   

   

 

Tutorial   Make  Your  Own  Simple  Dialer  App  Using  C2Call  SDK                                    

C2Call  SDK  Tutorial  V1.1       Requirements   a. XCode   b. Sample  code   c. Socialcommunication.framework   d. Socialcommunication.resources       1.  Open  Xcode    

      2.  Create  a  new  XCode  project    

 

 

 

 

2  

C2Call  SDK  Tutorial  V1.1     3.  Choose  “Tabbed  Application”      

      4.  Enter  the  product  name,  organization  name,  and  company  identifier.  Choose   Objective-­‐C  as  the  Language  (currently,  our  SDK  only  available  in  Objective-­‐C)    

 

 

 

3  

C2Call  SDK  Tutorial  V1.1     5.  Save  the  project  wherever  you  want    

 

      6.  Open  one  of  the  sample  projects    

 

 

4  

C2Call  SDK  Tutorial  V1.1     7.  Go  to  your  project’s  Build  Phases.    

  8.  Select  the  entire  framework  inside  SDK-­‐Frameworks  folder  from  sample  project,   drag  and  drop  them  to  your  project      

   

 

 

 

5  

C2Call  SDK  Tutorial  V1.1     9.  Add  standard  framework  by  pressing  plus  (+)  button.  Add  UIKit.framework,   CoreGraphics.framework  and  Foundation.framework    

 

 

 

6  

C2Call  SDK  Tutorial  V1.1     10.  Add  C2Call  SDK  to  your  project,  by  pressing  plus  (+)  button  and  Add  Other.  Then,   choose  the  SDK.    

                                             

 

7  

C2Call  SDK  Tutorial  V1.1     Your  link  binary  will  look  like  this    

      11.    Click  on  “Build  Setting”  tab    

   

 

 

 

8  

C2Call  SDK  Tutorial  V1.1     12.  Search  for  “header  search  path”  and  set  it  to:  /usr/include/libxml2    

 

    13.  Search  for  “other  linker”  and  set  it  to:  -­‐lxml2  and  –lstdc++    

14.  Click  on  Main.storyboard  and  uncheck  Use  Autolayout    

     

 

 

9  

C2Call  SDK  Tutorial  V1.1       15.  Delete  all  existing  controller    

      16.  Drag  and  drop  SocialCommunication.ressources  folder  to  your  project  

         

 

 

10  

C2Call  SDK  Tutorial  V1.1     Press  finish  

 

11  

C2Call  SDK  Tutorial  V1.1   17.  Open  SocialCommunication.ressources  folder  and  find  SCStoryboard    

 

      18.  Copy  the  Dialer  controller    

 

 

12  

C2Call  SDK  Tutorial  V1.1     19.  Paste  into  your  MainStoryboard    

      20.  Do  step  17-­‐19  again  for  login  controller,  profile  controller,  offerwall  controller   and  contact  controller.  

 

 

 

13  

C2Call  SDK  Tutorial  V1.1  

 

 

14  

C2Call  SDK  Tutorial  V1.1     21.  Your  MainStoryboard  will  look  like  this:    

  Connect  root  controller  to  dialer  controller  

 

 

15  

C2Call  SDK  Tutorial  V1.1  

 

      22.  Put  navigation  controller  from  pallet    

 

 

16  

C2Call  SDK  Tutorial  V1.1  

 

 

17  

C2Call  SDK  Tutorial  V1.1   23.  Connect  it  to  Contact  controller  and  from  root  controller    

 

  Add  table  view  controller  

     

 

18  

C2Call  SDK  Tutorial  V1.1           24.  Add  another  navigation  controller  and  connect  it  to  table  view  controller    

    25.  Select  on  the  table  view  and  change  the  content  to  static    

 

   

 

 

19  

C2Call  SDK  Tutorial  V1.1   26.Select  on  Table  View  Section    

      27.  Click  on  one  table  cell  and  change  the  style  to  Basic    

 

 

 

 

20  

C2Call  SDK  Tutorial  V1.1       28.  Your  table  view  controller  will  look  like  this:    

 

 

 

21  

C2Call  SDK  Tutorial  V1.1     29.  Change  all  the  label  text    

        30.  Connect  each  table  view  cell  to  each  controller  (selection)    

 

 

 

22  

C2Call  SDK  Tutorial  V1.1     31.  Copy  logout  class  from  sample  project    

    32.  Check  Add  to  target  and  then  press  Finish    

 

 

 

23  

C2Call  SDK  Tutorial  V1.1     33.  Copy  logout  controller  from  sample  project    

    34.  Connect  the  last  table  view  cell  to  logout  controller,  and  the  rest  to  the  root   controller,  your  mainstoryboard  will  look  like  this:    

 

24  

C2Call  SDK  Tutorial  V1.1  

 

 

25  

C2Call  SDK  Tutorial  V1.1     35.  Click  on  AppDelegate.h  and  change  the  content  to  this   #import #import @interface SPAppDelegate : C2CallAppDelegate @property (strong, nonatomic) UIWindow *window; @end  

  36.  Click  on  AppDelegate.m  and  change  the  content  to  this   #import "SPAppDelegate.h" @implementation SPAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.affiliateid = @"(your own affiliate id)"; self.secret = @"(your own secret)"; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (void)applicationWillResignActive:(UIApplication *)application { [super applicationWillResignActive:application]; } - (void)applicationDidEnterBackground:(UIApplication *)application { [super applicationDidEnterBackground:application]; } - (void)applicationWillEnterForeground:(UIApplication *)application { [super applicationWillEnterForeground:application]; } - (void)applicationDidBecomeActive:(UIApplication *)application { [super applicationDidBecomeActive:application]; } - (void)applicationWillTerminate:(UIApplication *)application { [super applicationWillTerminate:application]; } @end  

 

26  

C2Call  SDK  Tutorial  V1.1   37.  Click  on  SPLogoutViewController.m  and  change  the  content  to  this   #import "SPLogoutViewController.h" #import @interface SPLogoutViewController () @end @implementation SPLogoutViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(IBAction)logout:(id)sender { [[C2CallAppDelegate appDelegate] logoutUser]; [self.navigationController popViewControllerAnimated:NO]; self.tabBarController.selectedIndex = 0; } @end  

 

27  

C2Call  SDK  Tutorial  V1.1     38.  Click  on  the  connection  (segue)  and  change  the  identifier  into   SCLaunchScreenControllerSegue.  This  will  let  the  AddDelegate  to  run  the  launch   screen  when  the  user  is  not  logged  in    

    39.  Save  your  project,  and  run  it.      

 

    Please  visit  our  forum  for  support  or  any  feedback.  

 

28