3

Currently working on a game, and i've gotten to the point where i need to implement multiplayer functionality. I'm trying to load in the GameSparks SDK into my project but am unable to properly import the module and i'm not quite sure whats going on.

The SDK is written in Objective C, but my project is in Swift. They say all you need to do is to import the files into your project, so I installed it with cocoapods and copied the source files over into my project, my files look like this:

files

In my bridging header, i have

#ifndef SuperSpace_Bridging_Header_h
#define SuperSpace_Bridging_Header_h

#import <GS.h>
#import <GSAPI.h>

#endif /* SuperSpace_Bridging_Header_h */

and get no errors, everything compiles fine, however I have no access to the GS module that appears to be the core of the GameSparks SDK.

Has anybody had any luck with this SDK in iOS before? Maybe there is something about bridging between Objective-C and Swift that i'm not understanding?

Shan Robertson
  • 2,742
  • 3
  • 25
  • 43

1 Answers1

3

You should set the bridging header to the target -> Build Settings.

  1. Select target
  2. Click on Build Settings
  3. Search for bridging in search panel.
  4. add the Objective-C Bridging header name, in this case it is Header.h (you can use yours.)

Refer the following image for clear picture.

enter image description here

Try and share your results.

Bhavin Kansagara
  • 2,866
  • 1
  • 16
  • 20