Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ This app demonstrates Singular's best practices for implementing the iOS SDK.

This sample contains examples of:

- Initializing the SDK
- Requesting App Tracking Transparency
- Initializing the Singular SDK
- Setting Singular configuration options
- Enabling SkAdNetwork and Conversion Value management
- Setting Data Privacy option for GDPR or CCPA compliance
- Setting custom user id
- Sending custom events
- Sending simple revenue events
- Handling deep links / deferred deep links
- Sending revenue events
- Handling deep links / deferred deep links and passthroughs
- Enable ESP Tracking Domain

## Getting Started
To run the sample app you'll have to configure your own API Key / Secret as follows:

1. Retrieve the API Key & Secret from your account's SDK Keys page
1. Retrieve the API Key & Secret from your account's SDK Keys page, here: https://app.singular.net/?#/sdk
2. Open the ios-sample-app project in XCode
3. Go to the Constants.h file and replace the values of `APIKEY` & `SECRET` with your credentials
Binary file added ios-sample-app/.DS_Store
Binary file not shown.
Binary file added ios-sample-app/Singular-SDK/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions ios-sample-app/Singular-SDK/Singular.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import "SingularAdData.h"

// avoid circular include of SingularLinkParams
#ifndef SingularLinkParams
Expand Down Expand Up @@ -100,6 +101,7 @@
+ (void)unsetCustomUserId;

+ (void)setSessionTimeout:(int)timeout;
+ (NSInteger)getFirstSessionUnixTime;

+ (void)setWrapperName:(NSString*)name andVersion:(NSString*)version;

Expand All @@ -126,4 +128,12 @@
+ (BOOL)skanUpdateConversionValue:(NSInteger)conversionValue;
+ (NSNumber *)skanGetConversionValue;

/* Singular Links */

+(BOOL)isSingularLink:(id)linkHolder;

/* Admon Methods*/

+ (void)adRevenue:(SingularAdData*)adData;

@end
33 changes: 33 additions & 0 deletions ios-sample-app/Singular-SDK/SingularAdData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// SingularAdData.h
// Singular
//
// Created by Eyal Rabinovich on 13/06/2019.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface SingularAdData : NSMutableDictionary

- (id)initWithAdPlatfrom:(NSString*)adPlatform withCurrency:(NSString*)currency withRevenue:(NSNumber*)revenue;

- (void)setNetworkName:(NSString*)networkName;
- (void)setAdType:(NSString*)adType;
- (void)setGroupType:(NSString*)adGroupType;
- (void)setImpressionId:(NSString*)impressionId;
- (void)setAdPlacementName:(NSString*)adPlacementName;
- (void)setAdUnitId:(NSString*)adUnitId;
- (void)setAdGroupId:(NSString*)adGroupId;
- (void)setAdGroupName:(NSString*)adGroupName;
- (void)setAdGroupPriority:(NSString*)adGroupPriority;
- (void)setPrecision:(NSString*)precision;
- (void)setPlacementId:(NSString*)placementId;
- (void)setAdUnitName:(NSString*)adUnitName;

- (BOOL)hasRequiredParams;

@end

NS_ASSUME_NONNULL_END
2 changes: 2 additions & 0 deletions ios-sample-app/Singular-SDK/SingularConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@property void(^singularLinksHandler)(SingularLinkParams*);
@property long shortLinkResolveTimeOut;
@property NSArray* supportedDomains;
@property NSArray* espDomains;

// Global Properties fields
@property (readonly) NSMutableDictionary* globalProperties;
Expand All @@ -38,5 +39,6 @@
-(id)initWithApiKey:(NSString*)apikey andSecret:(NSString*)secret;

-(void)setGlobalProperty:(NSString*)key withValue:(NSString*)value overrideExisting:(BOOL)overrideExisiting;
-(NSString*)toJsonString;

@end
Binary file modified ios-sample-app/Singular-SDK/libSingular.a
Binary file not shown.
28 changes: 21 additions & 7 deletions ios-sample-app/ios-sample-app.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
2162674A238432070019FD74 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 21626749238432070019FD74 /* libz.tbd */; };
2162674C2384320C0019FD74 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2162674B2384320C0019FD74 /* AdSupport.framework */; };
2162674E238432110019FD74 /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2162674D238432110019FD74 /* iAd.framework */; };
216267542384340D0019FD74 /* libSingular.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 216267502384340D0019FD74 /* libSingular.a */; };
216267552384340D0019FD74 /* Singular.js in Resources */ = {isa = PBXBuildFile; fileRef = 216267512384340D0019FD74 /* Singular.js */; };
2162675823843BE70019FD74 /* CustomEventsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2162675723843BE70019FD74 /* CustomEventsController.m */; };
2162675C2384464C0019FD74 /* RevenueController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2162675B2384464C0019FD74 /* RevenueController.m */; };
Expand All @@ -28,6 +27,9 @@
21DB6DC2237C036E008E845A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21DB6DC0237C036E008E845A /* LaunchScreen.storyboard */; };
21DB6DC5237C036E008E845A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 21DB6DC4237C036E008E845A /* main.m */; };
27D1C9D924DC57120023B35F /* AppTrackingTransparency.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27D1C9D824DC57120023B35F /* AppTrackingTransparency.framework */; };
7FD16A032746D2C90065908B /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FD16A022746D2C90065908B /* WebKit.framework */; };
7FD16A052746D2D30065908B /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FD16A042746D2D30065908B /* StoreKit.framework */; };
7FD16A062746D2F00065908B /* libSingular.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 216267502384340D0019FD74 /* libSingular.a */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -64,13 +66,18 @@
21DB6DC3237C036E008E845A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
21DB6DC4237C036E008E845A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
27D1C9D824DC57120023B35F /* AppTrackingTransparency.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppTrackingTransparency.framework; path = System/Library/Frameworks/AppTrackingTransparency.framework; sourceTree = SDKROOT; };
7FD16A022746D2C90065908B /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
7FD16A042746D2D30065908B /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
21DB6DAC237C036B008E845A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7FD16A062746D2F00065908B /* libSingular.a in Frameworks */,
7FD16A052746D2D30065908B /* StoreKit.framework in Frameworks */,
7FD16A032746D2C90065908B /* WebKit.framework in Frameworks */,
216EAB98261F20B00085D00C /* AdServices.framework in Frameworks */,
27D1C9D924DC57120023B35F /* AppTrackingTransparency.framework in Frameworks */,
2162674E238432110019FD74 /* iAd.framework in Frameworks */,
Expand All @@ -79,7 +86,6 @@
21626748238432010019FD74 /* Security.framework in Frameworks */,
21626746238431F80019FD74 /* SystemConfiguration.framework in Frameworks */,
21626744238431F10019FD74 /* libsqlite3.0.tbd in Frameworks */,
216267542384340D0019FD74 /* libSingular.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -89,6 +95,8 @@
21626742238431F10019FD74 /* Frameworks */ = {
isa = PBXGroup;
children = (
7FD16A042746D2D30065908B /* StoreKit.framework */,
7FD16A022746D2C90065908B /* WebKit.framework */,
216EAB97261F20B00085D00C /* AdServices.framework */,
27D1C9D824DC57120023B35F /* AppTrackingTransparency.framework */,
2162674D238432110019FD74 /* iAd.framework */,
Expand Down Expand Up @@ -191,7 +199,7 @@
21DB6DA7237C036B008E845A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1110;
LastUpgradeCheck = 1310;
ORGANIZATIONNAME = "Singular Labs";
TargetAttributes = {
21DB6DAE237C036B008E845A = {
Expand Down Expand Up @@ -295,6 +303,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -354,6 +363,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -385,10 +395,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = "ios-sample-app/iOS Sample App.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = DZG6XY7PWJ;
DEVELOPMENT_TEAM = UL6RU95W7J;
INFOPLIST_FILE = "ios-sample-app/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -398,7 +409,8 @@
"${PROJECT_DIR}/Singular-SDK",
"$(PROJECT_DIR)/Singular-SDK",
);
PRODUCT_BUNDLE_IDENTIFIER = ios.sample.app;
MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = ios.sample.app.objc;
PRODUCT_NAME = iOSSampleApp;
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -409,10 +421,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_ENTITLEMENTS = "ios-sample-app/iOS Sample App.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = S84G4K2QJ2;
DEVELOPMENT_TEAM = UL6RU95W7J;
INFOPLIST_FILE = "ios-sample-app/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -422,7 +435,8 @@
"${PROJECT_DIR}/Singular-SDK",
"$(PROJECT_DIR)/Singular-SDK",
);
PRODUCT_BUNDLE_IDENTIFIER = ios.sample.app4;
MARKETING_VERSION = 2.0;
PRODUCT_BUNDLE_IDENTIFIER = ios.sample.app.objc;
PRODUCT_NAME = iOSSampleApp;
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Binary file added ios-sample-app/ios-sample-app/.DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion ios-sample-app/ios-sample-app/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
// ios-sample-app
//
// Created by Eyal Rabinovich on 13/11/2019.
// Copyright © 2019 Singular Labs. All rights reserved.
// Updated by Jared Ornstead on 2021/11/19
// Copyright © 2021 Singular Labs. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <UserNotifications/UserNotifications.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>{
NSDictionary* deeplinkData;
//NSString* s_idfa;
//NSString* s_idfv;
}

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain) NSDictionary* deeplinkData;
//@property (nonatomic, retain) NSString* att_state;
//@property (nonatomic, retain) NSString* s_idfa;
//@property (nonatomic, retain) NSString* s_idfv;

@end

Loading