wefi Analytics SDK for iOS

This section describes all integration steps that are required for successful integration. You can download the wefi SDK integration guide here.

Note: wefi SDK fo iOS requires iOS 7.1 version and above.

Add WeANDSF Folder

Click and drag the "WeANDSF" folder to the Framework folder of your project:


Mark "Copy items…“ and your project as the target:

Add Configuration File

Click and drag the WeANDSFConfig.txt file to your Supporting Files folder:


Mark "Copy items…“ and your project as the target:

Additional Search Paths

Add the following search paths to the hosting application environment:

Add Header Search Path

Follow these steps:

  1. Press on your Project name.
  2. Build Settings tab.
  3. Press on ‘All’ button.
  4. Go to "Search Paths" section.
  5. Double click "User Header Search Path".
  6. Add "$(PROJECT_DIR)/WeANDSF".
  7. Tick "Recursive".

Add Library Search Path

Follow these steps:

  1. Press on your Project name.
  2. Build Settings tab.
  3. Press on ‘All’ button.
  4. Go to "Search Paths" section.
  5. Double click "Library Search Path".
  6. Add "$(SRCROOT)/WeANDSF/$(PLATFORM_NAME)"
  7. Tick "Recursive".

NOTE:
If $(PROJECT_DIR)/WeANDSF/iphoneos or $(PROJECT_DIR)/WeANDSF/iphonesimulator exist in the "Library Search Path" – please remove it.

Add Linker Flag

Follow these steps:

  1. Press on your Project name.
  2. Build Settings tab.
  3. Press on ‘All’ button.
  4. Go to "Linking" section.
  5. Double click "Other Linker Flags".
  6. Add "–lweANDSFLibrary".

Add Required Libraries

Follow these steps:

  1. Press on your Project name.
  2. Choose Build Phases section.
  3. Open Link Binary With Libraries section

Verify the following libraries are linked to the framework of your project , otherwise add them and restart Xcode:

  • Libsqlite3.dylib
  • libz.dylib
  • CoreLocation.framwork
  • CFNetwork.framework
  • Libc++.dylib
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • MobileCoreServices.framework
  • SenTestingKit.framework
  • libz.dylib
  • CoreMotion.framework

Bind the Hosting Application to wefi

Add the following code to the hosting application:

AonInitReply

Add new Class that implements the WeANDSFClientDelegate protocol, add the following line to the onInitReply method:

NSLog(@"onInitReply: %d", initResult);

AppDelegate.h

Add the following code to AppDelegate.h:

#import <UIKit/UIKit.h>
#import "WeANDSFClientDelegateImpl.h"
#import "WeANDSFClient.h"
@interface AppDelegate : UIResponder 
{
      WeANDSFClientDelegateImpl * _delegate;
      WeANDSFClient* _client;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong,nonatomic) WeANDSFClientDelegateImpl* delegate;
@property (strong,nonatomic) WeANDSFClient* client

AppDelegate.m

Add the following code to AppDelegate.m:

@synthesize delegate = _delegate;
@synthesize client   = _client;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    if (!_delegate) {
        _delegate = [[WeANDSFClientDelegateImpl alloc] init];
    }
    if (!_client) {
        _client = [[WeANDSFClient alloc]init];
        WeANDSFCallingAppInfo *appInfo = [[WeANDSFCallingAppInfo alloc]
        initWithName:@"appInfo" andVersionNum:1
        andPackageName:<YOUR_BUNDLE_IDENTIFIER>];
        WeANDSFContext *context = [[WeANDSFContext alloc] init];
        [context setMotionActivityTracker:TRUE];
        [_client weANDSFInit:context withKey:@"key" withClientDelegate:_delegate andAppInfo:appInfo];
     }
     return YES;
}

Bind Hosting Application to wefi Tech

Binding you application to "wefi Tech" enables to handle SDK issues.

MessageUI.framwork

Add MessageUI.framwork library to your project framework by following these steps:

  1. Press on the Frameworks library.
  2. Choose Build Phases section.
  3. Open Link Binary With Libraries section

AppDelegate.m

Overwrite the following method in the AppDelegate.m:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
     [WeANDSFScheme url:url];
     return YES;
}

AppDelegate.h

Add the following import to AppDelegate.h

#import "WeANDSFScheme.h"

URL Schemes

  1. Choose the plist file.
  2. Add “URL types” key.
  3. Add “URL Schemes” item
  4. Insert “WeANDSFT-XXXX” value – XXX is the bundle name. For example: WeANDSFT-com.wefi.WeANDSFApiExample

Integration Verification Test

When all integration steps are completed, verify there are no exceptions or errors in the logs when your application starts. If you encounter any issues, contact us for support.