ObjectiveC for iOS Basic Tutorial

Hi!

I only find tutorials about how to implement everything in C#/Unity. Is there any tutorial for ObjectiveC in iOS? The sample projects are not very useful as they do many things... I need some step by step tutorial.

Thanks!

Comments

  • Hi @Rurouni.

    Currently there is no objC tutorial available. Sorry.

    I am sure you will find out that the sample projects are a lot easier to understand than you thought, once you give it a try.
  • yoman
    yoman
    edited February 2018
    Hello friends,

    We cant understand, how to ADD photonengine to ours project.

    How to start? How to integrate libs to the project?
  • yoman
    yoman
    edited February 2018
    Which package i must add to my objective c project? We want to use Photon Cloud.

    /LoadBalancing-objc ? or /LoadBalancing-cpp ? and or /Common-objc? or /Common-cpp?
    Each of this?


    Package Contents
    ------------------------------------------

    /Common-cpp - common sources
    /Common-objc - common sources Objective-C
    /LoadBalancing-cpp - Loadbalancing specific sources
    /LoadBalancing-objc - Loadbalancing specific sources Objective-C
    /Photon-cpp - common Photon sources
    /Photon-objc - common Photon sources Objective-C


    And how to link the library? After the drag/drop to the main project it always says: "File not found" when i try to #import "LoadBalancing-objc/inc/EGLoadBalancingClient.h"
  • Hi @yoman.

    You should make your project link against Common-objc, Photon-objc and LoadBalancing-objc and you need to tell it where to find the header files of the aforementioned libs as well as the ones of their C++ equivalents.

    I recommend you to have a look at the project and target settings of one of the demo projects, for example demo_loadBalancing_objc.



    As you can see that demo does the following to add Photon to the project:

    1. Add the parent-folder(s) of the folders Common-cpp/inc, Photon-cpp/inc, LoadBalancing-cpp/inc, Common-objc/inc, Photon-objc/inc and LoadBalancing-objc/inc to "Header Search Paths" in
    category "Search Paths" in your applications Project Settings
    (in the case of the demo the relative path to that folder is "../../..", but this might differ for your project depending on where you have put the aforementioned folders)

    2. In your Project Settings at category "Linking" add to "Other Linker Flags" the following entries:
    -lstdc++
    -force_load
    ../../../Common-objc/lib/libCommon-objc_$(CONFIGURATION)_$(PLATFORM_NAME).a
    -lCommon-objc_\$(CONFIGURATION)_\$(PLATFORM_NAME)
    -lPhoton-objc_\$(CONFIGURATION)_\$(PLATFORM_NAME)
    -lLoadBalancing-objc_\$(CONFIGURATION)_\$(PLATFORM_NAME)

    3. Add the folders Common-objc/lib, Photon-objc/lib and LoadBalancing-objc/lib to "Library Search Paths" in category "Search Paths" in your
    applications Project Settings

    4. Add the following \#import directive to your source-code:
    #import "LoadBalancing-objc/inc/EGLoadBalancingClient.h"



    When opening the demo_iPhone_loadBalancing_objc.xcodeproj\project.pbxproj file in a text editor, the relevant settings for each target look like this:
    
    				HEADER_SEARCH_PATHS = (
    					../inc,
    					../../..,
    				);
    
    
    				LIBRARY_SEARCH_PATHS = (
    					"../../../Common-objc/lib",
    					"../../../Photon-objc/lib",
    					"../../../LoadBalancing-objc/lib",
    				);
    
    
    				OTHER_LDFLAGS = (
    					"-lstdc++",
    					"-force_load",
    					"../../../Common-objc/lib/libCommon-objc_$(CONFIGURATION)_$(PLATFORM_NAME).a",
    					"-lCommon-objc_$(CONFIGURATION)_$(PLATFORM_NAME)",
    					"-lPhoton-objc_$(CONFIGURATION)_$(PLATFORM_NAME)",
    					"-lLoadBalancing-objc_$(CONFIGURATION)_$(PLATFORM_NAME)",
    				);
    
  • Thanks!)
    First problem was in "Linking"
    Second one was in my appDelegate format ".m" but yours NetworkLogic was ".mm"