# mFilterIt iOS SDK

## Getting Started

Integrating the mFilterIt Solution into an app includes Developer Registration and SDK integration.

## Developer Registration

Developers wishing to use mFilterIt should first register themselves. Upon registration a unique vendor ID and SDK credentials are allocated.

The vendor ID remains the same for all platforms supported (Android , iOS, Cordova , Unity etc.)

If you do not have a vendor ID, please contact us at <contact@mfilterit.com>

## SDK Integration

## 1. Integration using Framework

The SDK integration includes the followings :\
**Step 1** : The SDK is made available as a zip archive. This archive needs to be extracted and included into "Embedded Binaries" of your App project as shown in the screenshot given below.

![Adding framework to XCode project](/files/-LCIwaPiVJOpBDnRf41q)

**Step 2** : The SDK is initialized by adding an API call in appDelegate. This should be done in the "didFinishLaunchingWithOptions". SDK is invoked as shown below.

```objectivec
  MFAnalyticsConfiguration *configuration = [MFAnalyticsConfiguration         configurationWithWriteKey:@"YOUR VENDOR ID"];  configuration.flushAt = 1;      configuration.trackApplicationLifecycleEvents = YES;  [MFAnalytics setupWithConfiguration:configuration];
```

The below import statement should be added to the appDelegate.

```objectivec
#import <Mfilterit/Mfilterit.h>
```

## 2. Integration of framework using CocoaPods

**Step 1** : *\*\**&#x41;dd source to Podfile:

```
source 'https://github.com/mfilterit/MfilteritFramework-specs.git'
```

**Step 2** : Add following pod to app target block in the Podfile:

```
pod 'MfilteritiOSframework','{version_number}'
```

Note : Current SDK version number is '4.0.1'

**Step 3** : Run the below command by going to project directory

```
pod install
```

If prompted, please enter the crdentials as username and password, provided by us.

**Step 4** : The SDK is initialized by adding an API call in appDelegate. This should be done in the "didFinishLaunchingWithOptions". SDK is invoked as shown below.

```objectivec
 MFAnalyticsConfiguration *configuration = [MFAnalyticsConfiguration         configurationWithWriteKey:@"YOUR VENDOR ID"];  configuration.flushAt = 1;      configuration.trackApplicationLifecycleEvents = YES;  [MFAnalytics setupWithConfiguration:configuration];
```

The below import statement should be added to the appDelegate.

```objectivec
#import <Mfilterit/Mfilterit.h>
```

## Submitting to App Store

When you submit to the app store, be aware that the SDK collects the IDFA information . Even if you’re not currently doing mobile install attribution, if you get asked, “Does this app use the Advertising Identifier (IDFA)?” on [this](http://www.brianjcoleman.com/wp-content/uploads/2014/07/IDFA_Page2-1.jpg) page, you’ll want to **check** the following three boxes:

1. “Attribute this app installation to a previously served advertisement”
2. “Attribute an action taken within this app to a previously served advertisement”
3. “I, YOUR\_NAME, confirm that this app, and any third party…”

Note, you should *not* check the box labeled “Serve advertisements within the app” unless you are actually going to display ads.

### Removing simulator binary data when creating archive

A Run Script needs to be added to the Build Phases for the same, as shown below (please make sure that in build phases, order of run script should be at last):

![Configure Run Script](/files/-LCToOEm2Fg0p-Q3FKPv)

Please use the below code as the run script

```
echo "Target architectures: $ARCHS"

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name 'Mfilterit.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"

# remove simulator's archs if location is not simulator's directory
case "${TARGET_BUILD_DIR}" in
*"iphonesimulator")
echo "No need to remove archs"
;;
*)
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
echo "i386 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
echo "x86_64 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
;;
esac

echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

done
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mfilterit.com/mfilterit-sdk/mfilterit-ios-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
