mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-07 05:57:47 +00:00
GEEKING
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,818 @@
|
||||
//
|
||||
// Flurry.h
|
||||
// Flurry iOS Analytics Agent
|
||||
//
|
||||
// Copyright 2009-2012 Flurry, Inc. All rights reserved.
|
||||
//
|
||||
// Methods in this header file are for use with Flurry Analytics
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/*!
|
||||
* @brief Provides all available methods for defining and reporting Analytics from use
|
||||
* of your app.
|
||||
*
|
||||
* Set of methods that allow developers to capture detailed, aggregate information
|
||||
* regarding the use of their app by end users.
|
||||
*
|
||||
* @note This class provides methods necessary for correct function of FlurryAds.h.
|
||||
* For information on how to use Flurry's Ads SDK to
|
||||
* attract high-quality users and monetize your user base see <a href="http://support.flurry.com/index.php?title=Publishers">Support Center - Publishers</a>.
|
||||
*
|
||||
* @author 2009 - 2013 Flurry, Inc. All Rights Reserved.
|
||||
* @version 4.3.0
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Enum for setting up log output level.
|
||||
* @since 4.2.0
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
FlurryLogLevelNone = 0, //No output
|
||||
FlurryLogLevelCriticalOnly, //Default, outputs only critical log events
|
||||
FlurryLogLevelDebug, //Debug level, outputs critical and main log events
|
||||
FlurryLogLevelAll //Highest level, outputs all log events
|
||||
} FlurryLogLevel;
|
||||
|
||||
|
||||
@interface Flurry : NSObject {
|
||||
}
|
||||
|
||||
/** @name Pre-Session Calls
|
||||
* Optional sdk settings that should be called before start session.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief Explicitly specifies the App Version that Flurry will use to group Analytics data.
|
||||
* @since 2.7
|
||||
*
|
||||
* This is an optional method that overrides the App Version Flurry uses for reporting. Flurry will
|
||||
* use the CFBundleVersion in your info.plist file when this method is not invoked.
|
||||
*
|
||||
* @note There is a maximum of 605 versions allowed for a single app. \n
|
||||
* This method must be called prior to invoking #startSession:.
|
||||
*
|
||||
* @param version The custom version name.
|
||||
*/
|
||||
|
||||
+ (void)setAppVersion:(NSString *)version;
|
||||
|
||||
/*!
|
||||
* @brief Retrieves the Flurry Agent Build Version.
|
||||
* @since 2.7
|
||||
*
|
||||
* This is an optional method that retrieves the Flurry Agent Version the app is running under.
|
||||
* It is most often used if reporting an unexpected behavior of the SDK to <a href="mailto:iphonesupport@flurry.com">
|
||||
* Flurry Support</a>
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:. \n
|
||||
* FAQ for the iPhone SDK is located at <a href="http://wiki.flurry.com/index.php?title=IPhone_FAQ">
|
||||
* Support Center - iPhone FAQ</a>.
|
||||
*
|
||||
* @see #setLogLevel: for information on how to view debugging information on your console.
|
||||
*
|
||||
* @return The agent version of the Flurry SDK.
|
||||
*
|
||||
*/
|
||||
+ (NSString *)getFlurryAgentVersion;
|
||||
|
||||
/*!
|
||||
* @brief Displays an exception in the debug log if thrown during a Session.
|
||||
* @since 2.7
|
||||
*
|
||||
* This is an optional method that augments the debug logs with exceptions that occur during the session.
|
||||
* You must both capture exceptions to Flurry and set debug logging to enabled for this method to
|
||||
* display information to the console. The default setting for this method is @c NO.
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:.
|
||||
*
|
||||
* @see #setLogLevel: for information on how to view debugging information on your console. \n
|
||||
* #logError:message:exception: for details on logging exceptions. \n
|
||||
* #logError:message:error: for details on logging errors.
|
||||
*
|
||||
* @param value @c YES to show errors in debug logs, @c NO to omit errors in debug logs.
|
||||
*/
|
||||
+ (void)setShowErrorInLogEnabled:(BOOL)value;
|
||||
|
||||
/*!
|
||||
* @brief Generates debug logs to console.
|
||||
* @since 2.7
|
||||
*
|
||||
* This is an optional method that displays debug information related to the Flurry SDK.
|
||||
* display information to the console. The default setting for this method is @c NO
|
||||
* which sets the log level to @c FlurryLogLevelCriticalOnly.
|
||||
* When set to @c YES the debug log level is set to @c FlurryLogLevelDebug
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:. If the method, setLogLevel is called later in the code, debug logging will be automatically enabled.
|
||||
*
|
||||
* @param value @c YES to show debug logs, @c NO to omit debug logs.
|
||||
*
|
||||
*/
|
||||
+ (void)setDebugLogEnabled:(BOOL)value;
|
||||
|
||||
/*!
|
||||
* @brief Generates debug logs to console.
|
||||
* @since 4.2.2
|
||||
*
|
||||
* This is an optional method that displays debug information related to the Flurry SDK.
|
||||
* display information to the console. The default setting for this method is @c FlurryLogLevelCritycalOnly.
|
||||
*
|
||||
* @note Its good practice to call this method prior to invoking #startSession:. If debug logging is disabled earlier, this method will enable it.
|
||||
*
|
||||
* @param value Log level
|
||||
*
|
||||
*/
|
||||
+ (void)setLogLevel:(FlurryLogLevel)value;
|
||||
|
||||
/*!
|
||||
* @brief Set the timeout for expiring a Flurry session.
|
||||
* @since 2.7
|
||||
*
|
||||
* This is an optional method that sets the time the app may be in the background before
|
||||
* starting a new session upon resume. The default value for the session timeout is 10
|
||||
* seconds in the background.
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:.
|
||||
*
|
||||
* @param seconds The time in seconds to set the session timeout to.
|
||||
*/
|
||||
+ (void)setSessionContinueSeconds:(int)seconds;
|
||||
|
||||
/*!
|
||||
* @brief Send data over a secure transport.
|
||||
* @since 3.0
|
||||
*
|
||||
* This is an optional method that sends data over an SSL connection when enabled. The
|
||||
* default value is @c NO.
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:.
|
||||
*
|
||||
* @param value @c YES to send data over secure connection.
|
||||
*/
|
||||
+ (void)setSecureTransportEnabled:(BOOL)value;
|
||||
|
||||
/*!
|
||||
* @brief Enable automatic collection of crash reports.
|
||||
* @since 4.1
|
||||
*
|
||||
* This is an optional method that collects crash reports when enabled. The
|
||||
* default value is @c NO.
|
||||
*
|
||||
* @note This method must be called prior to invoking #startSession:.
|
||||
*
|
||||
* @param value @c YES to enable collection of crash reports.
|
||||
*/
|
||||
+ (void)setCrashReportingEnabled:(BOOL)value;
|
||||
|
||||
//@}
|
||||
|
||||
/*!
|
||||
* @brief Start a Flurry session for the project denoted by @c apiKey.
|
||||
* @since 2.6
|
||||
*
|
||||
* This method serves as the entry point to Flurry Analytics collection. It must be
|
||||
* called in the scope of @c applicationDidFinishLaunching. The session will continue
|
||||
* for the period the app is in the foreground until your app is backgrounded for the
|
||||
* time specified in #setSessionContinueSeconds:. If the app is resumed in that period
|
||||
* the session will continue, otherwise a new session will begin.
|
||||
*
|
||||
* Crash reporting will not be enabled. See #setCrashReportingEnabled: for
|
||||
* more information.
|
||||
*
|
||||
* @note If testing on a simulator, please be sure to send App to background via home
|
||||
* button. Flurry depends on the iOS lifecycle to be complete for full reporting.
|
||||
*
|
||||
* @see #setSessionContinueSeconds: for details on setting a custom session timeout.
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param apiKey The API key for this project.
|
||||
*/
|
||||
|
||||
+ (void)startSession:(NSString *)apiKey;
|
||||
|
||||
|
||||
/*!
|
||||
* @brief Start a Flurry session for the project denoted by @c apiKey.
|
||||
* @since 4.0.8
|
||||
*
|
||||
* This method serves as the entry point to Flurry Analytics collection. It must be
|
||||
* called in the scope of @c applicationDidFinishLaunching passing in the launchOptions param.
|
||||
* The session will continue
|
||||
* for the period the app is in the foreground until your app is backgrounded for the
|
||||
* time specified in #setSessionContinueSeconds:. If the app is resumed in that period
|
||||
* the session will continue, otherwise a new session will begin.
|
||||
*
|
||||
* @note If testing on a simulator, please be sure to send App to background via home
|
||||
* button. Flurry depends on the iOS lifecycle to be complete for full reporting.
|
||||
*
|
||||
* @see #setSessionContinueSeconds: for details on setting a custom session timeout.
|
||||
*
|
||||
* @code
|
||||
* - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY" withOptions:launchOptions];
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param apiKey The API key for this project.
|
||||
* @param options passed launchOptions from the applicatin's didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
|
||||
*/
|
||||
+ (void) startSession:(NSString *)apiKey withOptions:(id)options;
|
||||
|
||||
|
||||
/*!
|
||||
* @brief Pauses a Flurry session left running in background.
|
||||
* @since 4.2.2
|
||||
*
|
||||
* This method should be used in case of #setBackgroundSessionEnabled: set to YES. It can be
|
||||
* called when application finished all background tasks (such as playing music) to pause session.
|
||||
*
|
||||
* @see #setBackgroundSessionEnabled: for details on setting a custom behaviour on resigning activity.
|
||||
*
|
||||
* @code
|
||||
* - (void)allBackgroundTasksFinished
|
||||
{
|
||||
// ....
|
||||
[Flurry pauseBackgroundSession];
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
+ (void)pauseBackgroundSession;
|
||||
|
||||
/*!
|
||||
* @brief Adds an SDK origin specified by @c originName and @c originVersion.
|
||||
* @since 5.0.0
|
||||
*
|
||||
* This method allows you to specify origin within your Flurry SDK wrapper. As a general rule
|
||||
* you should capture all the origin info related to your wrapper for Flurry SDK after every session start.
|
||||
*
|
||||
* @see #addOrigin:withVersion:withParameters: for details on reporting origin info with parameters. \n
|
||||
*
|
||||
* @code
|
||||
* - (void)interestingSDKWrapperLibraryfunction
|
||||
{
|
||||
// ... after calling startSession
|
||||
[Flurry addOrigin:@"Interesting_Wrapper" withVersion:@"1.0.0"];
|
||||
// more code ...
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param originName Name of the origin.
|
||||
* @param originVersion Version string of the origin wrapper
|
||||
*/
|
||||
+ (void)addOrigin:(NSString *)originName withVersion:(NSString*)originVersion;
|
||||
|
||||
/*!
|
||||
* @brief Adds a custom parameterized origin specified by @c originName with @c originVersion and @c parameters.
|
||||
* @since 5.0.0
|
||||
*
|
||||
* This method overrides #addOrigin to allow you to associate parameters with an origin attribute. Parameters
|
||||
* are valuable as they allow you to store characteristics of an origin.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your origin info in a
|
||||
* custom origin. \n
|
||||
* A maximum of 9 parameter names may be associated with any origin. Sending
|
||||
* over 10 parameter names with a single origin will result in no parameters being logged
|
||||
* for that origin.
|
||||
*
|
||||
*
|
||||
* @code
|
||||
* - (void)userPurchasedSomethingCool
|
||||
{
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"Origin Info Item", // Parameter Value
|
||||
@"Origin Info Item Key", // Parameter Name
|
||||
nil];
|
||||
// ... after calling startSession
|
||||
[Flurry addOrigin:@"Interesting_Wrapper" withVersion:@"1.0.0"];
|
||||
// more code ...
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param originName Name of the origin.
|
||||
* @param originVersion Version string of the origin wrapper
|
||||
* @param parameters An immutable copy of map containing Name-Value pairs of parameters.
|
||||
*/
|
||||
+ (void)addOrigin:(NSString *)originName withVersion:(NSString*)originVersion withParameters:(NSDictionary *)parameters;
|
||||
|
||||
/** @name Event and Error Logging
|
||||
* Methods for reporting custom events and errors during the session.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief Records a custom event specified by @c eventName.
|
||||
* @since 2.8.4
|
||||
*
|
||||
* This method allows you to specify custom events within your app. As a general rule
|
||||
* you should capture events related to user navigation within your app, any action
|
||||
* around monetization, and other events as they are applicable to tracking progress
|
||||
* towards your business goals.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your users in a
|
||||
* custom event. \n
|
||||
* Where applicable, you should make a concerted effort to use timed events with
|
||||
* parameters (#logEvent:withParameters:timed:) or events with parameters
|
||||
* (#logEvent:withParameters:). This provides valuable information around the time the user
|
||||
* spends within an action (e.g. - time spent on a level or viewing a page) or characteristics
|
||||
* of an action (e.g. - Buy Event that has a Parameter of Widget with Value Golden Sword).
|
||||
*
|
||||
* @see #logEvent:withParameters: for details on storing events with parameters. \n
|
||||
* #logEvent:timed: for details on storing timed events. \n
|
||||
* #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
|
||||
* #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
|
||||
* parameters.
|
||||
*
|
||||
* @code
|
||||
* - (void)interestingAppAction
|
||||
{
|
||||
[Flurry logEvent:@"Interesting_Action"];
|
||||
// Perform interesting action
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
|
||||
* that can be easily understood by non-technical people in your business domain.
|
||||
*/
|
||||
+ (void)logEvent:(NSString *)eventName;
|
||||
|
||||
/*!
|
||||
* @brief Records a custom parameterized event specified by @c eventName with @c parameters.
|
||||
* @since 2.8.4
|
||||
*
|
||||
* This method overrides #logEvent to allow you to associate parameters with an event. Parameters
|
||||
* are extremely valuable as they allow you to store characteristics of an action. For example,
|
||||
* if a user purchased an item it may be helpful to know what level that user was on.
|
||||
* By setting this parameter you will be able to view a distribution of levels for the purcahsed
|
||||
* event on the <a href="http://dev.flurry.com">Flurrly Dev Portal</a>.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your users in a
|
||||
* custom event. \n
|
||||
* A maximum of 10 parameter names may be associated with any event. Sending
|
||||
* over 10 parameter names with a single event will result in no parameters being logged
|
||||
* for that event. You may specify an infinite number of Parameter values. For example,
|
||||
* a Search Box would have 1 parameter name (e.g. - Search Box) and many values, which would
|
||||
* allow you to see what values users look for the most in your app. \n
|
||||
* Where applicable, you should make a concerted effort to use timed events with
|
||||
* parameters (#logEvent:withParameters:timed:). This provides valuable information
|
||||
* around the time the user spends within an action (e.g. - time spent on a level or
|
||||
* viewing a page).
|
||||
*
|
||||
* @see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
|
||||
* #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
|
||||
* parameters.
|
||||
*
|
||||
* @code
|
||||
* - (void)userPurchasedSomethingCool
|
||||
{
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"Cool Item", // Parameter Value
|
||||
@"Item Purchased", // Parameter Name
|
||||
nil];
|
||||
[Flurry logEvent:@"Something Cool Purchased" withParameters:params];
|
||||
// Give user cool item
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
|
||||
* that can be easily understood by non-technical people in your business domain.
|
||||
* @param parameters An immutable copy of map containing Name-Value pairs of parameters.
|
||||
*/
|
||||
+ (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters;
|
||||
|
||||
/*!
|
||||
* @brief Records an app exception. Commonly used to catch unhandled exceptions.
|
||||
* @since 2.7
|
||||
*
|
||||
* This method captures an exception for reporting to Flurry. We recommend adding an uncaught
|
||||
* exception listener to capture any exceptions that occur during usage that is not
|
||||
* anticipated by your app.
|
||||
*
|
||||
* @see #logError:message:error: for details on capturing errors.
|
||||
*
|
||||
* @code
|
||||
* - (void) uncaughtExceptionHandler(NSException *exception)
|
||||
{
|
||||
[Flurry logError:@"Uncaught" message:@"Crash!" exception:exception];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param errorID Name of the error.
|
||||
* @param message The message to associate with the error.
|
||||
* @param exception The exception object to report.
|
||||
*/
|
||||
+ (void)logError:(NSString *)errorID message:(NSString *)message exception:(NSException *)exception;
|
||||
|
||||
/*!
|
||||
* @brief Records an app error.
|
||||
* @since 2.7
|
||||
*
|
||||
* This method captures an error for reporting to Flurry.
|
||||
*
|
||||
* @see #logError:message:exception: for details on capturing exceptions.
|
||||
*
|
||||
* @code
|
||||
* - (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
|
||||
{
|
||||
[Flurry logError:@"WebView No Load" message:[error localizedDescription] error:error];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param errorID Name of the error.
|
||||
* @param message The message to associate with the error.
|
||||
* @param error The error object to report.
|
||||
*/
|
||||
+ (void)logError:(NSString *)errorID message:(NSString *)message error:(NSError *)error;
|
||||
|
||||
/*!
|
||||
* @brief Records a timed event specified by @c eventName.
|
||||
* @since 2.8.4
|
||||
*
|
||||
* This method overrides #logEvent to allow you to capture the length of an event. This can
|
||||
* be extremely valuable to understand the level of engagement with a particular action. For
|
||||
* example, you can capture how long a user spends on a level or reading an article.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your users in a
|
||||
* custom event. \n
|
||||
* Where applicable, you should make a concerted effort to use parameters with your timed
|
||||
* events (#logEvent:withParameters:timed:). This provides valuable information
|
||||
* around the characteristics of an action (e.g. - Buy Event that has a Parameter of Widget with
|
||||
* Value Golden Sword).
|
||||
*
|
||||
* @see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
|
||||
* #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
|
||||
* parameters.
|
||||
*
|
||||
* @code
|
||||
* - (void)startLevel
|
||||
{
|
||||
[Flurry logEvent:@"Level Played" timed:YES];
|
||||
// Start user on level
|
||||
}
|
||||
|
||||
- (void)endLevel
|
||||
{
|
||||
[Flurry endTimedEvent:@"Level Played" withParameters:nil];
|
||||
// User done with level
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
|
||||
* that can be easily understood by non-technical people in your business domain.
|
||||
* @param timed Specifies the event will be timed.
|
||||
*/
|
||||
+ (void)logEvent:(NSString *)eventName timed:(BOOL)timed;
|
||||
|
||||
/*!
|
||||
* @brief Records a custom parameterized timed event specified by @c eventName with @c parameters.
|
||||
* @since 2.8.4
|
||||
*
|
||||
* This method overrides #logEvent to allow you to capture the length of an event with parameters.
|
||||
* This can be extremely valuable to understand the level of engagement with a particular action
|
||||
* and the characteristics associated with that action. For example, you can capture how long a user
|
||||
* spends on a level or reading an article. Parameters can be used to capture, for example, the
|
||||
* author of an article or if something was purchased while on the level.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your users in a
|
||||
* custom event.
|
||||
*
|
||||
* @see #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
|
||||
* parameters.
|
||||
*
|
||||
* @code
|
||||
* - (void)startLevel
|
||||
{
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
|
||||
@"Current Points", // Parameter Name
|
||||
nil];
|
||||
|
||||
[Flurry logEvent:@"Level Played" withParameters:params timed:YES];
|
||||
// Start user on level
|
||||
}
|
||||
|
||||
- (void)endLevel
|
||||
{
|
||||
// User gained additional 100 points in Level
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
|
||||
@"Current Points", // Parameter Name
|
||||
nil];
|
||||
[Flurry endTimedEvent:@"Level Played" withParameters:params];
|
||||
// User done with level
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
|
||||
* that can be easily understood by non-technical people in your business domain.
|
||||
* @param parameters An immutable copy of map containing Name-Value pairs of parameters.
|
||||
* @param timed Specifies the event will be timed.
|
||||
*/
|
||||
+ (void)logEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters timed:(BOOL)timed;
|
||||
|
||||
/*!
|
||||
* @brief Ends a timed event specified by @c eventName and optionally updates parameters with @c parameters.
|
||||
* @since 2.8.4
|
||||
*
|
||||
* This method ends an existing timed event. If parameters are provided, this will overwrite existing
|
||||
* parameters with the same name or create new parameters if the name does not exist in the parameter
|
||||
* map set by #logEvent:withParameters:timed:.
|
||||
*
|
||||
* @note You should not pass private or confidential information about your users in a
|
||||
* custom event. \n
|
||||
* If the app is backgrounded prior to ending a timed event, the Flurry SDK will automatically
|
||||
* end the timer on the event. \n
|
||||
* #endTimedEvent:withParameters: is ignored if called on a previously
|
||||
* terminated event.
|
||||
*
|
||||
* @see #logEvent:withParameters:timed: for details on starting a timed event with parameters.
|
||||
*
|
||||
* @code
|
||||
* - (void)startLevel
|
||||
{
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"100", // Parameter Value
|
||||
@"Current Points", // Parameter Name
|
||||
nil];
|
||||
|
||||
[Flurry logEvent:@"Level Played" withParameters:params timed:YES];
|
||||
// Start user on level
|
||||
}
|
||||
|
||||
- (void)endLevel
|
||||
{
|
||||
// User gained additional 100 points in Level
|
||||
NSDictionary *params =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"200", // Parameter Value
|
||||
@"Current Points", // Parameter Name
|
||||
nil];
|
||||
[Flurry endTimedEvent:@"Level Played" withParameters:params];
|
||||
// User done with level
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param eventName Name of the event. For maximum effectiveness, we recommend using a naming scheme
|
||||
* that can be easily understood by non-technical people in your business domain.
|
||||
* @param parameters An immutable copy of map containing Name-Value pairs of parameters.
|
||||
*/
|
||||
+ (void)endTimedEvent:(NSString *)eventName withParameters:(NSDictionary *)parameters; // non-nil parameters will update the parameters
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/** @name Page View Methods
|
||||
* Count page views.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @deprecated
|
||||
* @brief see +(void)logAllPageViewsForTarget:(id)target; for details
|
||||
* @since 2.7
|
||||
* This method does the same as +(void)logAllPageViewsForTarget:(id)target method and is left for backward compatibility
|
||||
*/
|
||||
+ (void)logAllPageViews:(id)target __attribute__ ((deprecated));
|
||||
/*!
|
||||
* @brief Automatically track page views on a @c UINavigationController or @c UITabBarController.
|
||||
* @since 4.3
|
||||
*
|
||||
* This method increments the page view count for a session based on traversing a UINavigationController
|
||||
* or UITabBarController. The page view count is only a counter for the number of transitions in your
|
||||
* app. It does not associate a name with the page count. To associate a name with a count of occurences
|
||||
* see #logEvent:.
|
||||
*
|
||||
* @note If you need to release passed target, you should call counterpart method + (void)stopLogPageViewsForTarget:(id)target before;
|
||||
*
|
||||
* @see #logPageView for details on explictly incrementing page view count.
|
||||
*
|
||||
* @code
|
||||
* -(void) trackViewsFromTabBar:(UITabBarController*) tabBar
|
||||
{
|
||||
[Flurry logAllPageViewsForTarget:tabBar];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param target The navigation or tab bar controller.
|
||||
*/
|
||||
+ (void)logAllPageViewsForTarget:(id)target;
|
||||
|
||||
/*!
|
||||
* @brief Stops logging page views on previously observed with logAllPageViewsForTarget: @c UINavigationController or @c UITabBarController.
|
||||
* @since 4.3
|
||||
*
|
||||
* Call this method before instance of @c UINavigationController or @c UITabBarController observed with logAllPageViewsForTarget: is released.
|
||||
*
|
||||
* @code
|
||||
* -(void) dealloc
|
||||
{
|
||||
[Flurry stopLogPageViewsForTarget:_tabBarController];
|
||||
[_tabBarController release];
|
||||
[super dealloc];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param target The navigation or tab bar controller.
|
||||
*/
|
||||
+ (void)stopLogPageViewsForTarget:(id)target;
|
||||
|
||||
/*!
|
||||
* @brief Explicitly track a page view during a session.
|
||||
* @since 2.7
|
||||
*
|
||||
* This method increments the page view count for a session when invoked. It does not associate a name
|
||||
* with the page count. To associate a name with a count of occurences see #logEvent:.
|
||||
*
|
||||
* @see #logAllPageViews for details on automatically incrementing page view count based on user
|
||||
* traversing navigation or tab bar controller.
|
||||
*
|
||||
* @code
|
||||
* -(void) trackView
|
||||
{
|
||||
[Flurry logPageView];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
+ (void)logPageView;
|
||||
|
||||
//@}
|
||||
|
||||
/** @name User Info
|
||||
* Methods to set user information.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief Assign a unique id for a user in your app.
|
||||
* @since 2.7
|
||||
*
|
||||
* @note Please be sure not to use this method to pass any private or confidential information
|
||||
* about the user.
|
||||
*
|
||||
* @param userID The app id for a user.
|
||||
*/
|
||||
+ (void)setUserID:(NSString *)userID;
|
||||
|
||||
/*!
|
||||
* @brief Set your user's age in years.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use this method to capture the age of your user. Only use this method if you collect this
|
||||
* information explictly from your user (i.e. - there is no need to set a default value).
|
||||
*
|
||||
* @note The age is aggregated across all users of your app and not available on a per user
|
||||
* basis.
|
||||
*
|
||||
* @param age Reported age of user.
|
||||
*
|
||||
*/
|
||||
+ (void)setAge:(int)age;
|
||||
|
||||
/*!
|
||||
* @brief Set your user's gender.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use this method to capture the gender of your user. Only use this method if you collect this
|
||||
* information explictly from your user (i.e. - there is no need to set a default value). Allowable
|
||||
* values are @c @"m" or @c @"f"
|
||||
*
|
||||
* @note The gender is aggregated across all users of your app and not available on a per user
|
||||
* basis.
|
||||
*
|
||||
* @param gender Reported gender of user.
|
||||
*
|
||||
*/
|
||||
+ (void)setGender:(NSString *)gender; // user's gender m or f
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Location Reporting
|
||||
* Methods for setting location information.
|
||||
*/
|
||||
//@{
|
||||
/*!
|
||||
* @brief Set the location of the session.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use information from the CLLocationManager to specify the location of the session. Flurry does not
|
||||
* automatically track this information or include the CLLocation framework.
|
||||
*
|
||||
* @note Only the last location entered is captured per session. \n
|
||||
* Regardless of accuracy specified, the Flurry SDK will only report location at city level or higher. \n
|
||||
* Location is aggregated across all users of your app and not available on a per user basis. \n
|
||||
* This information should only be captured if it is germaine to the use of your app.
|
||||
*
|
||||
* @code
|
||||
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
|
||||
[locationManager startUpdatingLocation];
|
||||
* @endcode
|
||||
*
|
||||
* After starting the location manager, you can set the location with Flurry. You can implement
|
||||
* CLLocationManagerDelegate to be aware of when the location is updated. Below is an example
|
||||
* of how to use this method, after you have recieved a location update from the locationManager.
|
||||
*
|
||||
* @code
|
||||
CLLocation *location = locationManager.location;
|
||||
[Flurry setLatitude:location.coordinate.latitude
|
||||
longitude:location.coordinate.longitude
|
||||
horizontalAccuracy:location.horizontalAccuracy
|
||||
verticalAccuracy:location.verticalAccuracy];
|
||||
* @endcode
|
||||
* @param latitude The latitude.
|
||||
* @param longitude The longitude.
|
||||
* @param horizontalAccuracy The radius of uncertainty for the location in meters.
|
||||
* @param verticalAccuracy The accuracy of the altitude value in meters.
|
||||
*
|
||||
*/
|
||||
+ (void)setLatitude:(double)latitude longitude:(double)longitude horizontalAccuracy:(float)horizontalAccuracy verticalAccuracy:(float)verticalAccuracy;
|
||||
|
||||
//@}
|
||||
|
||||
/** @name Session Reporting Calls
|
||||
* Optional methods that can be called at any point to control session reporting.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief Set session to report when app closes.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use this method report session data when the app is closed. The default value is @c YES.
|
||||
*
|
||||
* @note This method is rarely invoked in iOS >= 3.2 due to the updated iOS lifecycle.
|
||||
*
|
||||
* @see #setSessionReportsOnPauseEnabled:
|
||||
*
|
||||
* @param sendSessionReportsOnClose YES to send on close, NO to omit reporting on close.
|
||||
*
|
||||
*/
|
||||
+ (void)setSessionReportsOnCloseEnabled:(BOOL)sendSessionReportsOnClose;
|
||||
|
||||
/*!
|
||||
* @brief Set session to report when app is sent to the background.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use this method report session data when the app is paused. The default value is @c YES.
|
||||
*
|
||||
* @param setSessionReportsOnPauseEnabled YES to send on pause, NO to omit reporting on pause.
|
||||
*
|
||||
*/
|
||||
+ (void)setSessionReportsOnPauseEnabled:(BOOL)setSessionReportsOnPauseEnabled;
|
||||
|
||||
/*!
|
||||
* @brief Set session to support background execution.
|
||||
* @since 4.2.2
|
||||
*
|
||||
* Use this method to enable reporting of errors and events when application is
|
||||
* running in backgorund (such applications have UIBackgroundModes in Info.plist).
|
||||
* You should call #pauseBackgroundSession when appropriate in background mode to
|
||||
* pause the session (for example when played song completed in background)
|
||||
*
|
||||
* Default value is @c NO
|
||||
*
|
||||
* @see #pauseBackgroundSession for details
|
||||
*
|
||||
* @param setBackgroundSessionEnabled YES to enbale background support and
|
||||
* continue log events and errors for running session.
|
||||
*/
|
||||
+ (void)setBackgroundSessionEnabled:(BOOL)setBackgroundSessionEnabled;
|
||||
|
||||
/*!
|
||||
* @brief Enable custom event logging.
|
||||
* @since 2.7
|
||||
*
|
||||
* Use this method to allow the capture of custom events. The default value is @c YES.
|
||||
*
|
||||
* @param value YES to enable event logging, NO to stop custom logging.
|
||||
*
|
||||
*/
|
||||
+ (void)setEventLoggingEnabled:(BOOL)value;
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,339 @@
|
||||
//
|
||||
// FlurryAdDelegate.h
|
||||
// Flurry
|
||||
//
|
||||
// Copyright 2010 - 2013 Flurry, Inc. All rights reserved.
|
||||
//
|
||||
// Methods in this header file are for use with Flurry
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef enum {
|
||||
WEB_BANNER = 1,
|
||||
WEB_TAKEOVER = 2,
|
||||
VIDEO_TAKEOVER = 3,
|
||||
AD_BANNER = 4,
|
||||
AD_TAKEOVER = 5,
|
||||
NETWORK_BANNER = 6,
|
||||
NETWORK_TAKEOVER = 7
|
||||
} FlurryAdType;
|
||||
|
||||
/*!
|
||||
* @brief Provides all available delegates for receiving callbacks related to Ad Serving.
|
||||
*
|
||||
* Set of methods that allow developers to manage and take actions within
|
||||
* different phases of App ad display.
|
||||
*
|
||||
* @note This class serves as a delegate for FlurryAds. \n
|
||||
* For additional information on how to use Flurry's Ads SDK to
|
||||
* attract high-quality users and monetize your user base see <a href="http://wiki.flurry.com/index.php?title=Publisher">Support Center - Publisher</a>.
|
||||
* @author 2010 - 2013 Flurry, Inc. All Rights Reserved.
|
||||
* @version 4.3.0
|
||||
*
|
||||
*/
|
||||
@protocol FlurryAdDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/*!
|
||||
* @brief Invoked when an ad is received for the specified @c adSpace.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app that an ad has been received and is available for display.
|
||||
*
|
||||
* @see FlurryAds#fetchAdForSpace:frame:size: for details on the method that will invoke this delegate.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceDidReceiveAd:(NSString*)adSpace;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when an ad can not be retrieved for the specified @c adSpace.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app that an ad has failed to be received for the given adSpace.
|
||||
*
|
||||
* @see FlurryAds#fetchAdForSpace:frame:size: for details on the method that will invoke this delegate.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* @param error The error, if known, that caused ads not to be received.
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceDidFailToReceiveAd:(NSString*)adSpace error:(NSError *)error;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when an ad is about to display on the specified @c adSpace.
|
||||
* @since 4.1.0
|
||||
*
|
||||
* This method informs the app that an ad is about to be displayed. You can decide at this point not to show this ad by simply returning NO.
|
||||
*
|
||||
* @see FlurryAds#displayAdForSpace:view: for details on the method that will invoke this delegate. \n
|
||||
* FlurryAds#fetchAndDisplayAdForSpace:view:size: for details on the method that will invoke this delegate.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param interstitial YES/NO if the space to display will be an interstitial.
|
||||
*/
|
||||
- (BOOL) spaceShouldDisplay:(NSString*)adSpace interstitial:(BOOL)interstitial;
|
||||
|
||||
/*!
|
||||
* @brief [Deprecated] This method is deprecated. -[spaceShouldDisplay:interstitial:] should be used.
|
||||
*/
|
||||
- (BOOL)spaceShouldDisplay:(NSString*)adSpace forType:(FlurryAdType)type __attribute__ ((deprecated));
|
||||
|
||||
/*!
|
||||
* @brief Invoked when an ad is rendered.
|
||||
* @since 5.1.0
|
||||
*
|
||||
* This method informs the user an ad was retrieved, and successful in displaying to the user.
|
||||
*
|
||||
* @see FlurryAds#displayAdForSpace:view: for details on the method that will invoke this delegate. \n
|
||||
* FlurryAds#fetchAndDisplayAdForSpace:view:size: for details on the method that will invoke this delegate.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param interstitial YES/NO if the space to display will be an interstitial.
|
||||
*/
|
||||
- (void) spaceDidRender:(NSString *)space interstitial:(BOOL)interstitial;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when an ad fails to render.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method informs the user an ad was retrieved, however, was unsuccessful in displaying to the user (could be lost network connectivity for example).
|
||||
*
|
||||
* @see FlurryAds#displayAdForSpace:view: for details on the method that will invoke this delegate. \n
|
||||
* FlurryAds#fetchAndDisplayAdForSpace:view:size: for details on the method that will invoke this delegate.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* @param error The error, if known, that caused ads not to be rendered.
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceDidFailToRender:(NSString *)space error:(NSError *)error;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when the ad will be removed.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app that an ad will be removed.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
|
||||
* @param interstitial YES/NO indicates if space being removed is an interstitial
|
||||
*
|
||||
*/
|
||||
- (void)spaceWillDismiss:(NSString *)adSpace interstitial:(BOOL)interstitial;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when the ad has been removed.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method informs the app that an ad has closed. You can use this to resume app
|
||||
* states.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param interstitial YES/NO indicates if space being removed is an interstitial
|
||||
*/
|
||||
- (void)spaceDidDismiss:(NSString *)adSpace interstitial:(BOOL)interstitial;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when the ad has been selected that will take the user out of the app.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method informs the app that an ad has been clicked and the user is about to be taken outside the app.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void)spaceWillLeaveApplication:(NSString *)adSpace;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when a space will be expanded.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app an ad space (typcially a banner) will be expanded. Apps should pause their state when they receive this notification
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceWillExpand:(NSString *)adSpace;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when a space will be collapsed.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app an ad space (typcially a banner) will be collapsed.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceWillCollapse:(NSString *)adSpace;
|
||||
|
||||
/*!
|
||||
* @brief Invoked when a space has been collapsed.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app an ad space (typcially a banner) has been collapsed. Apps should resume their state when they receive this notification
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceDidCollapse:(NSString *)adSpace;
|
||||
|
||||
/*!
|
||||
* @brief Informational callback invoked when an ad is clicked for the specified @c adSpace.
|
||||
* @since 4.1
|
||||
*
|
||||
* This method informs the app that an ad has been clicked. This should not be used to adjust state of an app. It is only intended for informational purposes.
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
- (void) spaceDidReceiveClick:(NSString*)adSpace;
|
||||
|
||||
|
||||
/*!
|
||||
* @brief Invoked when a video finishes playing
|
||||
* @since 4.2.0
|
||||
*
|
||||
* This method informs the app that a video associated with an ad has finished playing
|
||||
*
|
||||
* @param adSpace The placement of an ad in your app, where placement may be splash screen for SPLASH_AD.
|
||||
*
|
||||
*/
|
||||
- (void)videoDidFinish:(NSString *)adSpace;
|
||||
|
||||
|
||||
@optional
|
||||
|
||||
#pragma mark App Keys
|
||||
/** @name Third party network Calls
|
||||
* Optional calls to pass information needed to display ads through 3rd parties.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* @brief The Millennial APID.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in Millennial, found here: https://developer.millennialmedia.com/Application/index.php#manageApps.
|
||||
*/
|
||||
- (NSString *)appSpotMillennialAppKey; //your millennial APID, found here: https://developer.millennialmedia.com/Application/index.php#manageApps
|
||||
|
||||
/*!
|
||||
* @brief The Millennial APID for interstitials.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in Millennial, found here: https://developer.millennialmedia.com/Application/index.php#manageApps.
|
||||
*/
|
||||
- (NSString *)appSpotMillennialInterstitalAppKey;
|
||||
|
||||
/*!
|
||||
* @brief The InMobi APID.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in InMobi, found here: https://www.inmobi.com/pub/mysite.html?platFormType=all
|
||||
*/
|
||||
- (NSString *)appSpotInMobiAppKey;
|
||||
|
||||
/*!
|
||||
* @brief The AdMob Publisher Id.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in AdMob, found here: http://www.admob.com/my_sites/ (click manage settings)
|
||||
*/
|
||||
- (NSString *)appSpotAdMobPublisherID;
|
||||
|
||||
/*!
|
||||
* @brief The Mobclix Application Id.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in Mobclix
|
||||
*/
|
||||
- (NSString *)appSpotMobclixApplicationID;
|
||||
|
||||
/*!
|
||||
* @brief The Jumptap Publisher Id.
|
||||
* @since 4.1.2
|
||||
*
|
||||
* This is the pub id for your app as set in Jumptap
|
||||
*/
|
||||
- (NSString *)appSpotJumptapPublisherID;
|
||||
|
||||
/*!
|
||||
* @brief The Jumptap Site Id.
|
||||
* @since 4.1.2
|
||||
*
|
||||
* This is the site id for your app as set in Jumptap. It is an optional parameter.
|
||||
*/
|
||||
- (NSString *)appSpotJumptapSiteID;
|
||||
|
||||
/*!
|
||||
* @brief Jumptap Banner Ad Spot ID
|
||||
* @since 4.1.2
|
||||
*
|
||||
* This is the ad spot id for a Banner (320x50) ad spot set in JumpTap
|
||||
*/
|
||||
- (NSString *)appSpotJumptapBannerAdSpotID;
|
||||
|
||||
/*!
|
||||
* @brief Jumptap Leaderboard Ad Spot ID
|
||||
* @since 4.1.2
|
||||
*
|
||||
* This is the ad spot id for a Leaderboard (720x90) ad spot set in JumpTap
|
||||
*/
|
||||
- (NSString *)appSpotJumptapLeaderboardAdSpotID;
|
||||
|
||||
/*!
|
||||
* @brief Jumptap Medium Rectange Ad Spot ID
|
||||
* @since 4.1.2
|
||||
*
|
||||
* This is the ad spot id for a Medium Rectangle (320x50) ad spot set in JumpTap.
|
||||
* The Medium Rectangle Ad Spot ID will be used whenever the ad frame can fit it
|
||||
* (e.g. interstitial ads).
|
||||
*/
|
||||
- (NSString *)appSpotJumptapMediumRectangleAdSpotID;
|
||||
|
||||
/*!
|
||||
* @brief The Greystripe Application Id.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This is the id for your app as set in Greystripe
|
||||
*/
|
||||
- (NSString *)appSpotGreystripeApplicationID;
|
||||
|
||||
|
||||
#pragma mark Information
|
||||
|
||||
|
||||
#pragma mark Callbacks
|
||||
|
||||
/*!
|
||||
* @brief [Deprecated] Allow you to set your rootViewController.
|
||||
* @since 4.0.0
|
||||
* @deprecated
|
||||
*
|
||||
* This method has been deprecated. Please call FlurryAds#initialze: instead.
|
||||
*
|
||||
*/
|
||||
- (id)appSpotRootViewController __attribute__ ((deprecated));
|
||||
|
||||
#pragma mark Optional settings
|
||||
|
||||
/**
|
||||
Some networks support accelerometer-enabled ads.
|
||||
*/
|
||||
/*!
|
||||
* @brief For networks that support accelerometer-enabled ads.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method allows you to enable accelerometer based ads for networks that support this setting via the client sdk. Set to NO if your app uses the accelerometer
|
||||
to avoid conflict. Set to YES if you want the special ads. Default is NO.
|
||||
*/
|
||||
- (BOOL)appSpotAccelerometerEnabled;
|
||||
|
||||
//@}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,464 @@
|
||||
//
|
||||
// FlurryAds.h
|
||||
// Flurry iOS Analytics Agent
|
||||
//
|
||||
// Copyright 2009-2013 Flurry, Inc. All rights reserved.
|
||||
//
|
||||
// Methods in this header file are for use by Flurry Publishers
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef enum {
|
||||
BANNER_TOP = 1,
|
||||
BANNER_BOTTOM = 2,
|
||||
FULLSCREEN = 3,
|
||||
} FlurryAdSize;
|
||||
|
||||
@protocol FlurryCustomAdNetwork;
|
||||
@protocol FlurryCustomAdNetworkProperties;
|
||||
|
||||
/*!
|
||||
* @brief Provides all available methods for displaying ads.
|
||||
*
|
||||
* Set of methods that allow publishers to configure, target, and deliver ads to their customers.
|
||||
*
|
||||
* @note This class depends on Flurry.h.
|
||||
* For information on how to use Flurry's Ads SDK to
|
||||
* attract high-quality users and monetize your user base see <a href="http://support.flurry.com/index.php?title=Publishers">Support Center - Publishers</a>.
|
||||
*
|
||||
* @author 2009 - 2013 Flurry, Inc. All Rights Reserved.
|
||||
* @version 4.3.0
|
||||
*
|
||||
*/
|
||||
@interface FlurryAds : NSObject {
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Retrieves an ad for the given @c space.
|
||||
* @since 4.1.0
|
||||
*
|
||||
* This method will attempt to retrieve ads for the given space from the Flurry server.
|
||||
*
|
||||
* @note The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. For example, if you are displaying a full screen ad on your
|
||||
* splash screen and after level completeion, you may have the following spaces
|
||||
* @c @"SPLASH_AD" and @c @"LEVEL_AD".
|
||||
*
|
||||
* @see #removeAdFromSpace: for details on manually removing an ad from a view. \n
|
||||
* FlurryAdDelegate#spaceDidReceiveAd: for details on the notification of ads being received.
|
||||
* FlurryAdDelegate#spaceDidFailToReceiveAd:error: for details on notification of failure to receive ads from this request.
|
||||
* #displayAdForSpace: for details on displaying an available ad.
|
||||
*
|
||||
* @code
|
||||
* - (void)fetchAd:(NSString *)placement
|
||||
{
|
||||
// Placement may be SPLASH_AD as noted above
|
||||
[FlurryAds fetchAdForSpace:placement view:self.view.frame size:FULLSCREEN];
|
||||
}
|
||||
|
||||
// Show whenever delegate is invoked
|
||||
- (void) spaceDidReceiveAd:(NSString *)adSpace {
|
||||
// Received Ad
|
||||
[FlurryAds displayAdForSpace:adSpace];
|
||||
}
|
||||
// Alternatively, try to display at a certain point in the app
|
||||
- (void) levelComplete {
|
||||
if([FlurryAds adReadyForSpace:adSpace]) {
|
||||
[FlurryAds displayAdForSpace:adSpace];
|
||||
}
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param frame The frame of the view that will be used for the ad container.
|
||||
* @param size The default size of an ad space. This can be overriden on the server. See @c FlurryAdSize in the FlurryAds.h file for allowable values.
|
||||
*/
|
||||
+(void) fetchAdForSpace:(NSString*)space frame:(CGRect)frame size:(FlurryAdSize)size;
|
||||
|
||||
/*!
|
||||
* @brief Returns if an ad is currently ready to display for a given @c space.
|
||||
* @since 4.1.0
|
||||
*
|
||||
* This method will verify if there is an ad is currently available for this
|
||||
* user. If an ad is not available, you may call #fetchAdForSpace:view:size: to load a new ad.
|
||||
*
|
||||
* @note If this method returns YES, an ad will be available when you attempt to display an ad. However, it is still advisable to listen to the delegate FlurryAdsDelegate#spaceDidFailToRender:. \n
|
||||
The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. For example, if you are displaying a full screen ad on your
|
||||
* splash screen and after level completeion, you may have the following spaces
|
||||
* @c @"SPLASH_AD" and @c @"LEVEL_AD".
|
||||
*
|
||||
* @see #fetchAdForSpace:view:size: for details on retrieving an ad.\n
|
||||
#displayAdForSpace: for details on displaying the available ad.
|
||||
*
|
||||
* @code
|
||||
* - (void)showButtonForAd:(NSString *)placement
|
||||
{
|
||||
// Placement may be SPLASH_AD as noted above
|
||||
if([FlurryAds adReadyForSpace:placement])
|
||||
{
|
||||
// Show button that ads are available.
|
||||
}
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*
|
||||
* @return YES/NO to indicate if an ad is ready to be displayed.
|
||||
*/
|
||||
+(BOOL) adReadyForSpace:(NSString*)space;
|
||||
|
||||
/*!
|
||||
* @brief Display an ad for the given @c space.
|
||||
* @since 4.1.0
|
||||
*
|
||||
* This method will display an ad if one is ready for display on the device.
|
||||
*
|
||||
* @note The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your
|
||||
* splash screen and after level completeion, you may have the following spaces
|
||||
* @c @"SPLASH_AD" and @c @"LEVEL_AD".
|
||||
*
|
||||
* @see #fetchAdForSpace:view:size: for details on retrieving an ad.\n
|
||||
#adReadyForSpace: for details on verifying is an ad is ready to be displayed. \n
|
||||
* #removeAdFromSpace: for details on manually removing an ad from a view. \n
|
||||
* FlurryAdDelegate#spaceShouldDisplay:forType: for details on controlling whether an ad will display immediately before it is set to be rendered to the user.
|
||||
* FlurryAdDelegate#spaceDidFailToRender:error: for details on notification of error in rendering an ad for this request.
|
||||
*
|
||||
* @code
|
||||
* - (void)showFullscreenAd:(NSString *)placement
|
||||
{
|
||||
// Placement may be SPLASH_AD as noted above
|
||||
if([FlurryAds adReadyForSpace:placement])
|
||||
{
|
||||
[FlurryAds displayAdForSpace:placement onView:view];
|
||||
}
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* @param view The view to place the ad. The view frame should be identical to the view frame passed in #fetchAdForSpace:frame:size. Note view is not used for interstitials.
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
+ (void)displayAdForSpace:(NSString*)space onView:(UIView *)view;
|
||||
|
||||
/*!
|
||||
* @brief Display an ad for the given interstitial @c space.
|
||||
* @since 4.2.2
|
||||
*
|
||||
* This method will display an interstitial ad if one is ready for display on the device for specified UIViewController instance
|
||||
*
|
||||
* @note The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your
|
||||
* splash screen and after level completeion, you may have the following spaces
|
||||
* @c @"SPLASH_AD" and @c @"LEVEL_AD".
|
||||
*
|
||||
* @see #fetchAdForSpace:view:size: for details on retrieving an ad.\n
|
||||
#adReadyForSpace: for details on verifying is an ad is ready to be displayed. \n
|
||||
* #removeAdFromSpace: for details on manually removing an ad from a view. \n
|
||||
* FlurryAdDelegate#spaceShouldDisplay:forType: for details on controlling whether an ad will display immediately before it is set to be rendered to the user.
|
||||
* FlurryAdDelegate#spaceDidFailToRender:error: for details on notification of error in rendering an ad for this request.
|
||||
*
|
||||
* @code
|
||||
* in UIViewController based class:
|
||||
* - (void)showFullscreenAd:(NSString *)placement
|
||||
{
|
||||
// Placement may be SPLASH_AD as noted above
|
||||
if([FlurryAds adReadyForSpace:placement])
|
||||
{
|
||||
[FlurryAds displayAdForSpace:placement modallyForViewController:self];
|
||||
}
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* @param viewController The viewController to show the fullscreen ad modally.
|
||||
* Note this method should not be used for banners.
|
||||
*/
|
||||
+ (void)displayAdForSpace:(NSString*)space modallyForViewController:(UIViewController *)viewController;
|
||||
|
||||
/*!
|
||||
* @brief [Deprecated] Check if an ad is available for the given @c space.
|
||||
* @since 4.0.0
|
||||
* @deprecated
|
||||
*
|
||||
* [Deprecated] This method will verify with the Flurry server if an ad is currently available for this
|
||||
* user. If an ad is not available, we recommend not providing the user the
|
||||
* option to view. For example, you may have a button that reads "See other great apps!".
|
||||
* That button should only be displayed if this method returns YES.
|
||||
*
|
||||
* @note This method has been deprecated.
|
||||
*
|
||||
* @see #fetchAdForSpace:view:size: for replacement method.\n
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param view The UIView in your app that the ad will be placed as a subview. Note: for fullscreen ads, this view is not used as a container, but the size of the view may still be used for determining what types of ads will fit in this space.
|
||||
* @param size The default size of an ad space. This can be overriden on the server. See @c FlurryAdSize in the FlurryAds.h file for allowable values.
|
||||
* @param timeout The maximum amount of time to wait for the server to return a result. Set this to 0 to check the cache and return immediately.
|
||||
*
|
||||
* @return YES/NO to indicate if an ad is available.
|
||||
*/
|
||||
+(BOOL) isAdAvailableForSpace:(NSString*)space view:(UIView *)view size:(FlurryAdSize)size timeout:(int64_t)timeout __attribute__ ((deprecated));
|
||||
|
||||
/*!
|
||||
* @brief [Deprecated] Display an ad for the given @c space.
|
||||
* @since 4.0.0
|
||||
* @deprecated
|
||||
*
|
||||
* [Deprecated] This method will display an ad if one is available from the Flurry server for this
|
||||
* user.
|
||||
*
|
||||
* @note This method has been deprecated.
|
||||
*
|
||||
* @see #fetchAndDisplayAdForSpace:view:size:timeout: for replacement method
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param view The UIView in your app that the ad will be placed as a subview. Note: for fullscreen ads, this view is not used as a container, but the size of the view may still be used for determining what types of ads will fit in this space.
|
||||
* @param size The default size of an ad space. This can be overriden on the server. See @c FlurryAdSize in the FlurryAds.h file for allowable values.
|
||||
* @param timeout The maximum amount of time to wait for the server to return a valid ad. Set this to 0 to display an ad in the background (e.g. - for showing banners).
|
||||
*
|
||||
* @return YES/NO to indicate if an ad is available.
|
||||
*/
|
||||
+ (BOOL)showAdForSpace:(NSString*)space view:(UIView *)viewContainer size:(FlurryAdSize)size timeout:(int64_t)timeout __attribute__ ((deprecated));
|
||||
|
||||
/*!
|
||||
* @brief Fetch and Display an ad for the given @c space.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method will display an ad if one is available from the Flurry server for this
|
||||
* user.
|
||||
*
|
||||
* @note If this method returns YES, an ad is available for the space within @c timeout. \n
|
||||
* This is a blocking method that allows you to change the user experience based on availability of an ad. If you would like to display an ad asynchronously, just set timeout to 0. This is useful in the case of banners for instance where the user should not wait for its display. If you are loading async with timeout set to 0, ignore the return value of this method and rely exclusively on the relevant delegate methods listed below\n
|
||||
* The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. Only one ad will show at a time for any given ad space. For example, if you are displaying a full screen ad on your
|
||||
* splash screen and after level completeion, you may have the following spaces
|
||||
* @c @"SPLASH_AD" and @c @"LEVEL_AD".
|
||||
*
|
||||
* @see #adReadyForSpace: for details on verifying is an ad is ready to be displayed. \n
|
||||
* #removeAdFromSpace: for details on manually removing an ad from a view. \n
|
||||
* FlurryAdDelegate#spaceDidReceiveAd: for details on the notification of ads being received.
|
||||
* FlurryAdDelegate#spaceDidFailToReceiveAd:error: for details on notification of failure to receive ads from this request.
|
||||
* FlurryAdDelegate#spaceShouldDisplay:forType: for details on controlling whether an ad will display immediately before it is set to be rendered to the user.
|
||||
* FlurryAdDelegate#spaceDidFailToRender:error: for details on notification of error in rendering an ad for this request.
|
||||
*
|
||||
* @code
|
||||
* - (void)showFullscreenAd:(NSString *)placement
|
||||
{
|
||||
// Placement may be SPLASH_AD as noted above
|
||||
[FlurryAds fetchAndDisplayAdForSpace:placement view:self.view size:FULLSCREEN timeout:3000];
|
||||
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
// Show a banner whenever this view appears
|
||||
// Display banner ad completely asyncrhonously by providing timeout == 0
|
||||
[FlurryAds fetchAndDisplayAdForSpace:@"VIEW_XYZ_BANNER_AD" view:self.view size:BANNER_BOTTOM timeout:0];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
* @param view The UIView in your app that the ad will be placed as a subview. Note: for fullscreen ads, this view is not used as a container, but the size of the view may still be used for determining what types of ads will fit in this space.
|
||||
* @param size The default size of an ad space. This can be overriden on the server. See @c FlurryAdSize in the FlurryAds.h file for allowable values.
|
||||
*/
|
||||
+ (void)fetchAndDisplayAdForSpace:(NSString*)space view:(UIView *)viewContainer size:(FlurryAdSize)size;
|
||||
|
||||
/*!
|
||||
* @brief Removes an ad for the given @c space.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method will remove an ad if one is currently displaying.
|
||||
*
|
||||
* @note The @c space simply represents the placement of the ad in your app and should be
|
||||
* unique for each placement. Only one ad will show at a time for any given ad space.
|
||||
*
|
||||
* @see #isAdAvailableForSpace:view:size:timeout: for details on displaying an available ad. \n
|
||||
* #removeAdFromSpace: for details on manually removing an ad from a view. \n
|
||||
* FlurryAdDelegate#spaceShouldDisplay:forType: for details on controlling whether an ad will display immediately before it is set to be rendered to the user.
|
||||
*
|
||||
* @code
|
||||
* - (void)viewDidUnload
|
||||
{
|
||||
// Remove a banner whenever this view dissapears
|
||||
[FlurryAds removeAdFromSpace:@"VIEW_XYZ_BANNER_AD"];
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param space The placement of an ad in your app, where placement may
|
||||
* be splash screen for SPLASH_AD.
|
||||
*/
|
||||
+ (void) removeAdFromSpace:(NSString*)space;
|
||||
|
||||
/*!
|
||||
* @brief Initializes the ad serving system.
|
||||
* @since 4.0
|
||||
*
|
||||
* This method initializes the ad serving system and can be used to pre-cache ads from the server (this is done when ad spaces are configured on the server).
|
||||
*
|
||||
* @note This method must be called sometime after Flurry#startSession:.
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
[FlurryAds setAdDelegate:self];
|
||||
[FlurryAds initialize:myWindow.rootViewController];
|
||||
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param rvc The primary root view controller of your app.
|
||||
*
|
||||
*/
|
||||
+ (void) initialize: (UIViewController *)rvc;
|
||||
|
||||
/*!
|
||||
* @brief Sets the object to receive various delegate methods.
|
||||
* @since 4.0
|
||||
*
|
||||
* This method allows you to register an object that will receive
|
||||
* notifications at different phases of ad serving.
|
||||
*
|
||||
* @see FlurryAdDelegate.h for details on delegates available.
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
[FlurryAds setAdDelegate:self];
|
||||
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param delegate The object to receive notifications of various ad actions.
|
||||
*
|
||||
*/
|
||||
+ (void)setAdDelegate:(id)delegate;
|
||||
|
||||
/*!
|
||||
* @brief Informs server to send test ads.
|
||||
* @since 4.0
|
||||
*
|
||||
* This method allows you to request test ads from the server. These ads do not generate revenue so it is CRITICAL this call is removed prior to app submission.
|
||||
*
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
[FlurryAds enableTestAds:YES];
|
||||
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param enable YES to receive test ads to the device. Not including this method is equivalent to passing NO.
|
||||
*
|
||||
*/
|
||||
+ (void)enableTestAds:(BOOL)enable;
|
||||
|
||||
/*!
|
||||
* @brief Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when a user clicks on an ad.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* UserCookies allow the developer to specify information on a user executing an ad action. There is one UserCookie object, and on each ad click that UserCookie is transmitted to the Flurry servers. The UserCookie key/value pairs will be transmitted back to the developer via the app callback if one is set. This is useful for rewarded inventory, to identify which of your users should be rewarded when a reward callback is sent.
|
||||
*
|
||||
* @note Calling this method with a nil or empty dictionary has no effect. Calling this method a second time with a valid dictionary will replace the previous entries. To clear previously set userCookies, you must call #clearUserCookies.
|
||||
* @see #clearUserCookies for details on removing user cookies set through this method.
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
|
||||
NSDictionary *cookies =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"xyz123", // Parameter Value
|
||||
@"UserCharacterId", // Parameter Name
|
||||
nil];
|
||||
[FlurryAds setUserCookies:cookies];
|
||||
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param userCookies The information about the user executing ad actions. Note: do not transmit personally identifiable information in the user cookies.
|
||||
*/
|
||||
+ (void) setUserCookies:(NSDictionary *) userCookies;
|
||||
|
||||
/*!
|
||||
* @brief Removes a previously set dictionary of key/value pairs.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method removes information from the one UserCookie object.
|
||||
*
|
||||
* @see #setUserCookies: for details on setting user cookies.
|
||||
*
|
||||
*/
|
||||
+ (void) clearUserCookies;
|
||||
|
||||
/*!
|
||||
* @brief Sets a dictionary of key/value pairs, which will be transmitted to Flurry servers when an ad is requested.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* Keywords allow the developer to specify information on a user executing an ad action for the purposes of targeting. There is one keywords object that is transmitted to the Flurry servers on each ad request. If corresponding keywords are matched on the ad server, a subset of targeted ads will be delivered. This allows partners to supply information they track internally, which is not available to Flurry's targeting system.
|
||||
*
|
||||
* @note Calling this method with a nil or empty dictionary has no effect. Calling this method a second time with a valid dictionary will replace the previous entries. To clear previously set keywords, you must call #clearKeywords.
|
||||
* @see #clearKeywords for details on removing keywords set through this method.
|
||||
*
|
||||
* @code
|
||||
* - (void)applicationDidFinishLaunching:(UIApplication *)application
|
||||
{
|
||||
// Optional Flurry startup methods
|
||||
[Flurry startSession:@"YOUR_API_KEY"];
|
||||
|
||||
// Specify that user loves vacations
|
||||
NSDictionary *keywords =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:@"vacation", // Parameter Value
|
||||
@"UserPreference", // Parameter Name
|
||||
nil];
|
||||
[FlurryAds setKeywords:keywords];
|
||||
|
||||
// ....
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* @param keywords The information about the user to be used in targeting an ad. Note: do not transmit personally identifiable information in keywords.
|
||||
*/
|
||||
+ (void) setKeywordsForTargeting:(NSDictionary*) keywords;
|
||||
|
||||
/*!
|
||||
* @brief Removes a previously set dictionary of key/value pairs.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method removes information from the one keywords object.
|
||||
*
|
||||
* @see #setKeywords: for details on setting keywords.
|
||||
*
|
||||
*/
|
||||
+ (void) clearKeywords;
|
||||
|
||||
/*!
|
||||
* @brief Method to add a custom ad network to be served through the standard Flurry ad system.
|
||||
* @since 4.0.0
|
||||
*
|
||||
* This method adds a network with the necessary publisher supplied properties to the Flurry sdk.
|
||||
*
|
||||
* @see @c FlurryCustomAdNetwork and @c FlurryCustomAdNetworkProperties for details.
|
||||
*
|
||||
*/
|
||||
+ (void) addCustomAdNetwork:(Class<FlurryCustomAdNetwork>)adNetworkClass withProperties:(id<FlurryCustomAdNetworkProperties>)adNetworkProperties;
|
||||
|
||||
|
||||
@end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
Developer's use of the SDK is governed by the license in the applicable Flurry Terms of Service.Ê Some components of the SDK are governed by open source software licenses.Ê In the event of any conflict betweenÊ the license in the applicable Flurry Terms of Service and the applicable open source license, the terms of the open source license shall prevail with respect to those components.Ê
|
||||
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
This file is part of Appirater.
|
||||
|
||||
Copyright (c) 2012, Arash Payan
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Appirater.h
|
||||
* appirater
|
||||
*
|
||||
* Created by Arash Payan on 9/5/09.
|
||||
* http://arashpayan.com
|
||||
* Copyright 2012 Arash Payan. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AppiraterDelegate.h"
|
||||
#import <StoreKit/StoreKit.h>
|
||||
|
||||
extern NSString *const kAppiraterFirstUseDate;
|
||||
extern NSString *const kAppiraterUseCount;
|
||||
extern NSString *const kAppiraterSignificantEventCount;
|
||||
extern NSString *const kAppiraterCurrentVersion;
|
||||
extern NSString *const kAppiraterRatedCurrentVersion;
|
||||
extern NSString *const kAppiraterDeclinedToRate;
|
||||
extern NSString *const kAppiraterReminderRequestDate;
|
||||
|
||||
/*!
|
||||
Your localized app's name.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_APP_NAME [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"]
|
||||
|
||||
/*!
|
||||
Your app's name.
|
||||
*/
|
||||
#define APPIRATER_APP_NAME APPIRATER_LOCALIZED_APP_NAME ? APPIRATER_LOCALIZED_APP_NAME : [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]
|
||||
|
||||
/*!
|
||||
This is the message your users will see once they've passed the day+launches
|
||||
threshold.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_MESSAGE NSLocalizedStringFromTableInBundle(@"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!", @"AppiraterLocalizable", [Appirater bundle], nil)
|
||||
#define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]
|
||||
|
||||
/*!
|
||||
This is the title of the message alert that users will see.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_MESSAGE_TITLE NSLocalizedStringFromTableInBundle(@"Rate %@", @"AppiraterLocalizable", [Appirater bundle], nil)
|
||||
#define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE_TITLE, APPIRATER_APP_NAME]
|
||||
|
||||
/*!
|
||||
The text of the button that rejects reviewing the app.
|
||||
*/
|
||||
#define APPIRATER_CANCEL_BUTTON NSLocalizedStringFromTableInBundle(@"No, Thanks", @"AppiraterLocalizable", [Appirater bundle], nil)
|
||||
|
||||
/*!
|
||||
Text of button that will send user to app review page.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedStringFromTableInBundle(@"Rate %@", @"AppiraterLocalizable", [Appirater bundle], nil)
|
||||
#define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]
|
||||
|
||||
/*!
|
||||
Text for button to remind the user to review later.
|
||||
*/
|
||||
#define APPIRATER_RATE_LATER NSLocalizedStringFromTableInBundle(@"Remind me later", @"AppiraterLocalizable", [Appirater bundle], nil)
|
||||
|
||||
@interface Appirater : NSObject <UIAlertViewDelegate, SKStoreProductViewControllerDelegate> {
|
||||
|
||||
UIAlertView *ratingAlert;
|
||||
}
|
||||
|
||||
@property(nonatomic, strong) UIAlertView *ratingAlert;
|
||||
@property(nonatomic) BOOL openInAppStore;
|
||||
#if __has_feature(objc_arc_weak)
|
||||
@property(nonatomic, weak) NSObject <AppiraterDelegate> *delegate;
|
||||
#else
|
||||
@property(nonatomic, unsafe_unretained) NSObject <AppiraterDelegate> *delegate;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Tells Appirater that the app has launched, and on devices that do NOT
|
||||
support multitasking, the 'uses' count will be incremented. You should
|
||||
call this method at the end of your application delegate's
|
||||
application:didFinishLaunchingWithOptions: method.
|
||||
|
||||
If the app has been used enough to be rated (and enough significant events),
|
||||
you can suppress the rating alert
|
||||
by passing NO for canPromptForRating. The rating alert will simply be postponed
|
||||
until it is called again with YES for canPromptForRating. The rating alert
|
||||
can also be triggered by appEnteredForeground: and userDidSignificantEvent:
|
||||
(as long as you pass YES for canPromptForRating in those methods).
|
||||
*/
|
||||
+ (void)appLaunched:(BOOL)canPromptForRating;
|
||||
|
||||
/*!
|
||||
Tells Appirater that the app was brought to the foreground on multitasking
|
||||
devices. You should call this method from the application delegate's
|
||||
applicationWillEnterForeground: method.
|
||||
|
||||
If the app has been used enough to be rated (and enough significant events),
|
||||
you can suppress the rating alert
|
||||
by passing NO for canPromptForRating. The rating alert will simply be postponed
|
||||
until it is called again with YES for canPromptForRating. The rating alert
|
||||
can also be triggered by appLaunched: and userDidSignificantEvent:
|
||||
(as long as you pass YES for canPromptForRating in those methods).
|
||||
*/
|
||||
+ (void)appEnteredForeground:(BOOL)canPromptForRating;
|
||||
|
||||
/*!
|
||||
Tells Appirater that the user performed a significant event. A significant
|
||||
event is whatever you want it to be. If you're app is used to make VoIP
|
||||
calls, then you might want to call this method whenever the user places
|
||||
a call. If it's a game, you might want to call this whenever the user
|
||||
beats a level boss.
|
||||
|
||||
If the user has performed enough significant events and used the app enough,
|
||||
you can suppress the rating alert by passing NO for canPromptForRating. The
|
||||
rating alert will simply be postponed until it is called again with YES for
|
||||
canPromptForRating. The rating alert can also be triggered by appLaunched:
|
||||
and appEnteredForeground: (as long as you pass YES for canPromptForRating
|
||||
in those methods).
|
||||
*/
|
||||
+ (void)userDidSignificantEvent:(BOOL)canPromptForRating;
|
||||
|
||||
/*!
|
||||
Tells Appirater to try and show the prompt (a rating alert). The prompt will be showed
|
||||
if there is connection available, the user hasn't declined to rate
|
||||
or hasn't rated current version.
|
||||
|
||||
You could call to show the prompt regardless Appirater settings,
|
||||
e.g., in case of some special event in your app.
|
||||
*/
|
||||
+ (void)tryToShowPrompt;
|
||||
|
||||
/*!
|
||||
Tells Appirater to show the prompt (a rating alert).
|
||||
Similar to tryToShowPrompt, but without checks (the prompt is always displayed).
|
||||
Passing false will hide the rate later button on the prompt.
|
||||
|
||||
The only case where you should call this is if your app has an
|
||||
explicit "Rate this app" command somewhere. This is similar to rateApp,
|
||||
but instead of jumping to the review directly, an intermediary prompt is displayed.
|
||||
*/
|
||||
+ (void)forceShowPrompt:(BOOL)displayRateLaterButton;
|
||||
|
||||
/*!
|
||||
Tells Appirater to open the App Store page where the user can specify a
|
||||
rating for the app. Also records the fact that this has happened, so the
|
||||
user won't be prompted again to rate the app.
|
||||
|
||||
The only case where you should call this directly is if your app has an
|
||||
explicit "Rate this app" command somewhere. In all other cases, don't worry
|
||||
about calling this -- instead, just call the other functions listed above,
|
||||
and let Appirater handle the bookkeeping of deciding when to ask the user
|
||||
whether to rate the app.
|
||||
*/
|
||||
+ (void)rateApp;
|
||||
|
||||
/*!
|
||||
Tells Appirater to immediately close any open rating modals (e.g. StoreKit rating VCs).
|
||||
*/
|
||||
+ (void)closeModal;
|
||||
|
||||
@end
|
||||
|
||||
@interface Appirater(Configuration)
|
||||
|
||||
/*!
|
||||
Set your Apple generated software id here.
|
||||
*/
|
||||
+ (void) setAppId:(NSString*)appId;
|
||||
|
||||
/*!
|
||||
Users will need to have the same version of your app installed for this many
|
||||
days before they will be prompted to rate it.
|
||||
*/
|
||||
+ (void) setDaysUntilPrompt:(double)value;
|
||||
|
||||
/*!
|
||||
An example of a 'use' would be if the user launched the app. Bringing the app
|
||||
into the foreground (on devices that support it) would also be considered
|
||||
a 'use'. You tell Appirater about these events using the two methods:
|
||||
[Appirater appLaunched:]
|
||||
[Appirater appEnteredForeground:]
|
||||
|
||||
Users need to 'use' the same version of the app this many times before
|
||||
before they will be prompted to rate it.
|
||||
*/
|
||||
+ (void) setUsesUntilPrompt:(NSInteger)value;
|
||||
|
||||
/*!
|
||||
A significant event can be anything you want to be in your app. In a
|
||||
telephone app, a significant event might be placing or receiving a call.
|
||||
In a game, it might be beating a level or a boss. This is just another
|
||||
layer of filtering that can be used to make sure that only the most
|
||||
loyal of your users are being prompted to rate you on the app store.
|
||||
If you leave this at a value of -1, then this won't be a criterion
|
||||
used for rating. To tell Appirater that the user has performed
|
||||
a significant event, call the method:
|
||||
[Appirater userDidSignificantEvent:];
|
||||
*/
|
||||
+ (void) setSignificantEventsUntilPrompt:(NSInteger)value;
|
||||
|
||||
|
||||
/*!
|
||||
Once the rating alert is presented to the user, they might select
|
||||
'Remind me later'. This value specifies how long (in days) Appirater
|
||||
will wait before reminding them.
|
||||
*/
|
||||
+ (void) setTimeBeforeReminding:(double)value;
|
||||
|
||||
/*!
|
||||
Set customized title for alert view.
|
||||
*/
|
||||
+ (void) setCustomAlertTitle:(NSString *)title;
|
||||
|
||||
/*!
|
||||
Set customized message for alert view.
|
||||
*/
|
||||
+ (void) setCustomAlertMessage:(NSString *)message;
|
||||
|
||||
/*!
|
||||
Set customized cancel button title for alert view.
|
||||
*/
|
||||
+ (void) setCustomAlertCancelButtonTitle:(NSString *)cancelTitle;
|
||||
|
||||
/*!
|
||||
Set customized rate button title for alert view.
|
||||
*/
|
||||
+ (void) setCustomAlertRateButtonTitle:(NSString *)rateTitle;
|
||||
|
||||
/*!
|
||||
Set customized rate later button title for alert view.
|
||||
*/
|
||||
+ (void) setCustomAlertRateLaterButtonTitle:(NSString *)rateLaterTitle;
|
||||
|
||||
/*!
|
||||
'YES' will show the Appirater alert everytime. Useful for testing how your message
|
||||
looks and making sure the link to your app's review page works.
|
||||
*/
|
||||
+ (void) setDebug:(BOOL)debug;
|
||||
|
||||
/*!
|
||||
Set the delegate if you want to know when Appirater does something
|
||||
*/
|
||||
+ (void)setDelegate:(id<AppiraterDelegate>)delegate;
|
||||
|
||||
/*!
|
||||
Set whether or not Appirater uses animation (currently respected when pushing modal StoreKit rating VCs).
|
||||
*/
|
||||
+ (void)setUsesAnimation:(BOOL)animation;
|
||||
|
||||
/*!
|
||||
If set to YES, Appirater will open App Store link (instead of SKStoreProductViewController on iOS 6). Default NO.
|
||||
*/
|
||||
+ (void)setOpenInAppStore:(BOOL)openInAppStore;
|
||||
|
||||
/*!
|
||||
If set to YES, the main bundle will always be used to load localized strings.
|
||||
Set this to YES if you have provided your own custom localizations in AppiraterLocalizable.strings
|
||||
in your main bundle. Default is NO.
|
||||
*/
|
||||
+ (void)setAlwaysUseMainBundle:(BOOL)useMainBundle;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/*!
|
||||
Methods in this interface are public out of necessity, but may change without notice
|
||||
*/
|
||||
@interface Appirater(Unsafe)
|
||||
|
||||
/*!
|
||||
The bundle localized strings will be loaded from.
|
||||
*/
|
||||
+(NSBundle *)bundle;
|
||||
|
||||
@end
|
||||
|
||||
@interface Appirater(Deprecated)
|
||||
|
||||
/*!
|
||||
DEPRECATED: While still functional, it's better to use
|
||||
appLaunched:(BOOL)canPromptForRating instead.
|
||||
|
||||
Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality.
|
||||
*/
|
||||
+ (void)appLaunched __attribute__((deprecated));
|
||||
|
||||
/*!
|
||||
DEPRECATED: While still functional, it's better to use
|
||||
tryToShowPrompt instead.
|
||||
|
||||
Calls [Appirater tryToShowPrompt]. See tryToShowPrompt for details of functionality.
|
||||
*/
|
||||
+ (void)showPrompt __attribute__((deprecated));
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,682 @@
|
||||
/*
|
||||
This file is part of Appirater.
|
||||
|
||||
Copyright (c) 2012, Arash Payan
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Appirater.m
|
||||
* appirater
|
||||
*
|
||||
* Created by Arash Payan on 9/5/09.
|
||||
* http://arashpayan.com
|
||||
* Copyright 2012 Arash Payan. All rights reserved.
|
||||
*/
|
||||
|
||||
#import "Appirater.h"
|
||||
#import <SystemConfiguration/SCNetworkReachability.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#if ! __has_feature(objc_arc)
|
||||
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
|
||||
#endif
|
||||
|
||||
NSString *const kAppiraterFirstUseDate = @"kAppiraterFirstUseDate";
|
||||
NSString *const kAppiraterUseCount = @"kAppiraterUseCount";
|
||||
NSString *const kAppiraterSignificantEventCount = @"kAppiraterSignificantEventCount";
|
||||
NSString *const kAppiraterCurrentVersion = @"kAppiraterCurrentVersion";
|
||||
NSString *const kAppiraterRatedCurrentVersion = @"kAppiraterRatedCurrentVersion";
|
||||
NSString *const kAppiraterDeclinedToRate = @"kAppiraterDeclinedToRate";
|
||||
NSString *const kAppiraterReminderRequestDate = @"kAppiraterReminderRequestDate";
|
||||
|
||||
NSString *templateReviewURL = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
|
||||
NSString *templateReviewURLiOS7 = @"itms-apps://itunes.apple.com/app/idAPP_ID";
|
||||
|
||||
static NSString *_appId;
|
||||
static double _daysUntilPrompt = 30;
|
||||
static NSInteger _usesUntilPrompt = 20;
|
||||
static NSInteger _significantEventsUntilPrompt = -1;
|
||||
static double _timeBeforeReminding = 1;
|
||||
static BOOL _debug = NO;
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
|
||||
static id<AppiraterDelegate> _delegate;
|
||||
#else
|
||||
__weak static id<AppiraterDelegate> _delegate;
|
||||
#endif
|
||||
static BOOL _usesAnimation = TRUE;
|
||||
static UIStatusBarStyle _statusBarStyle;
|
||||
static BOOL _modalOpen = false;
|
||||
static BOOL _alwaysUseMainBundle = NO;
|
||||
|
||||
@interface Appirater ()
|
||||
@property (nonatomic, copy) NSString *alertTitle;
|
||||
@property (nonatomic, copy) NSString *alertMessage;
|
||||
@property (nonatomic, copy) NSString *alertCancelTitle;
|
||||
@property (nonatomic, copy) NSString *alertRateTitle;
|
||||
@property (nonatomic, copy) NSString *alertRateLaterTitle;
|
||||
- (BOOL)connectedToNetwork;
|
||||
+ (Appirater*)sharedInstance;
|
||||
- (void)showPromptWithChecks:(BOOL)withChecks
|
||||
displayRateLaterButton:(BOOL)displayRateLaterButton;
|
||||
- (void)showRatingAlert:(BOOL)displayRateLaterButton;
|
||||
- (void)showRatingAlert;
|
||||
- (BOOL)ratingConditionsHaveBeenMet;
|
||||
- (void)incrementUseCount;
|
||||
- (void)hideRatingAlert;
|
||||
@end
|
||||
|
||||
@implementation Appirater
|
||||
|
||||
@synthesize ratingAlert;
|
||||
|
||||
+ (void) setAppId:(NSString *)appId {
|
||||
_appId = appId;
|
||||
}
|
||||
|
||||
+ (void) setDaysUntilPrompt:(double)value {
|
||||
_daysUntilPrompt = value;
|
||||
}
|
||||
|
||||
+ (void) setUsesUntilPrompt:(NSInteger)value {
|
||||
_usesUntilPrompt = value;
|
||||
}
|
||||
|
||||
+ (void) setSignificantEventsUntilPrompt:(NSInteger)value {
|
||||
_significantEventsUntilPrompt = value;
|
||||
}
|
||||
|
||||
+ (void) setTimeBeforeReminding:(double)value {
|
||||
_timeBeforeReminding = value;
|
||||
}
|
||||
|
||||
+ (void) setCustomAlertTitle:(NSString *)title
|
||||
{
|
||||
[self sharedInstance].alertTitle = title;
|
||||
}
|
||||
|
||||
+ (void) setCustomAlertMessage:(NSString *)message
|
||||
{
|
||||
[self sharedInstance].alertMessage = message;
|
||||
}
|
||||
|
||||
+ (void) setCustomAlertCancelButtonTitle:(NSString *)cancelTitle
|
||||
{
|
||||
[self sharedInstance].alertCancelTitle = cancelTitle;
|
||||
}
|
||||
|
||||
+ (void) setCustomAlertRateButtonTitle:(NSString *)rateTitle
|
||||
{
|
||||
[self sharedInstance].alertRateTitle = rateTitle;
|
||||
}
|
||||
|
||||
+ (void) setCustomAlertRateLaterButtonTitle:(NSString *)rateLaterTitle
|
||||
{
|
||||
[self sharedInstance].alertRateLaterTitle = rateLaterTitle;
|
||||
}
|
||||
|
||||
+ (void) setDebug:(BOOL)debug {
|
||||
_debug = debug;
|
||||
}
|
||||
+ (void)setDelegate:(id<AppiraterDelegate>)delegate{
|
||||
_delegate = delegate;
|
||||
}
|
||||
+ (void)setUsesAnimation:(BOOL)animation {
|
||||
_usesAnimation = animation;
|
||||
}
|
||||
+ (void)setOpenInAppStore:(BOOL)openInAppStore {
|
||||
[Appirater sharedInstance].openInAppStore = openInAppStore;
|
||||
}
|
||||
+ (void)setStatusBarStyle:(UIStatusBarStyle)style {
|
||||
_statusBarStyle = style;
|
||||
}
|
||||
+ (void)setModalOpen:(BOOL)open {
|
||||
_modalOpen = open;
|
||||
}
|
||||
+ (void)setAlwaysUseMainBundle:(BOOL)alwaysUseMainBundle {
|
||||
_alwaysUseMainBundle = alwaysUseMainBundle;
|
||||
}
|
||||
|
||||
+ (NSBundle *)bundle
|
||||
{
|
||||
NSBundle *bundle;
|
||||
|
||||
if (_alwaysUseMainBundle) {
|
||||
bundle = [NSBundle mainBundle];
|
||||
} else {
|
||||
NSURL *appiraterBundleURL = [[NSBundle mainBundle] URLForResource:@"Appirater" withExtension:@"bundle"];
|
||||
|
||||
if (appiraterBundleURL) {
|
||||
// Appirater.bundle will likely only exist when used via CocoaPods
|
||||
bundle = [NSBundle bundleWithURL:appiraterBundleURL];
|
||||
} else {
|
||||
bundle = [NSBundle mainBundle];
|
||||
}
|
||||
}
|
||||
|
||||
return bundle;
|
||||
}
|
||||
|
||||
- (NSString *)alertTitle
|
||||
{
|
||||
return _alertTitle ? _alertTitle : APPIRATER_MESSAGE_TITLE;
|
||||
}
|
||||
|
||||
- (NSString *)alertMessage
|
||||
{
|
||||
return _alertMessage ? _alertMessage : APPIRATER_MESSAGE;
|
||||
}
|
||||
|
||||
- (NSString *)alertCancelTitle
|
||||
{
|
||||
return _alertCancelTitle ? _alertCancelTitle : APPIRATER_CANCEL_BUTTON;
|
||||
}
|
||||
|
||||
- (NSString *)alertRateTitle
|
||||
{
|
||||
return _alertRateTitle ? _alertRateTitle : APPIRATER_RATE_BUTTON;
|
||||
}
|
||||
|
||||
- (NSString *)alertRateLaterTitle
|
||||
{
|
||||
return _alertRateLaterTitle ? _alertRateLaterTitle : APPIRATER_RATE_LATER;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {
|
||||
self.openInAppStore = YES;
|
||||
} else {
|
||||
self.openInAppStore = NO;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)connectedToNetwork {
|
||||
// Create zero addy
|
||||
struct sockaddr_in zeroAddress;
|
||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||
zeroAddress.sin_family = AF_INET;
|
||||
|
||||
// Recover reachability flags
|
||||
SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
|
||||
SCNetworkReachabilityFlags flags;
|
||||
|
||||
BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
|
||||
CFRelease(defaultRouteReachability);
|
||||
|
||||
if (!didRetrieveFlags)
|
||||
{
|
||||
NSLog(@"Error. Could not recover network reachability flags");
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL isReachable = flags & kSCNetworkFlagsReachable;
|
||||
BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
|
||||
BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
|
||||
|
||||
NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
|
||||
NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];
|
||||
NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
|
||||
|
||||
return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
|
||||
}
|
||||
|
||||
+ (Appirater*)sharedInstance {
|
||||
static Appirater *appirater = nil;
|
||||
if (appirater == nil)
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
appirater = [[Appirater alloc] init];
|
||||
appirater.delegate = _delegate;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive) name:
|
||||
UIApplicationWillResignActiveNotification object:nil];
|
||||
});
|
||||
}
|
||||
|
||||
return appirater;
|
||||
}
|
||||
|
||||
- (void)showRatingAlert:(BOOL)displayRateLaterButton {
|
||||
UIAlertView *alertView = nil;
|
||||
if (displayRateLaterButton) {
|
||||
alertView = [[UIAlertView alloc] initWithTitle:self.alertTitle
|
||||
message:self.alertMessage
|
||||
delegate:self
|
||||
cancelButtonTitle:self.alertCancelTitle
|
||||
otherButtonTitles:self.alertRateTitle, self.alertRateLaterTitle, nil];
|
||||
} else {
|
||||
alertView = [[UIAlertView alloc] initWithTitle:self.alertTitle
|
||||
message:self.alertMessage
|
||||
delegate:self
|
||||
cancelButtonTitle:self.alertCancelTitle
|
||||
otherButtonTitles:self.alertRateTitle, nil];
|
||||
}
|
||||
|
||||
self.ratingAlert = alertView;
|
||||
[alertView show];
|
||||
|
||||
id <AppiraterDelegate> delegate = _delegate;
|
||||
if (delegate && [delegate respondsToSelector:@selector(appiraterDidDisplayAlert:)]) {
|
||||
[delegate appiraterDidDisplayAlert:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showRatingAlert
|
||||
{
|
||||
[self showRatingAlert:true];
|
||||
}
|
||||
|
||||
- (BOOL)ratingConditionsHaveBeenMet {
|
||||
if (_debug)
|
||||
return YES;
|
||||
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSDate *dateOfFirstLaunch = [NSDate dateWithTimeIntervalSince1970:[userDefaults doubleForKey:kAppiraterFirstUseDate]];
|
||||
NSTimeInterval timeSinceFirstLaunch = [[NSDate date] timeIntervalSinceDate:dateOfFirstLaunch];
|
||||
NSTimeInterval timeUntilRate = 60 * 60 * 24 * _daysUntilPrompt;
|
||||
if (timeSinceFirstLaunch < timeUntilRate)
|
||||
return NO;
|
||||
|
||||
// check if the app has been used enough
|
||||
NSInteger useCount = [userDefaults integerForKey:kAppiraterUseCount];
|
||||
if (useCount < _usesUntilPrompt)
|
||||
return NO;
|
||||
|
||||
// check if the user has done enough significant events
|
||||
NSInteger sigEventCount = [userDefaults integerForKey:kAppiraterSignificantEventCount];
|
||||
if (sigEventCount < _significantEventsUntilPrompt)
|
||||
return NO;
|
||||
|
||||
// has the user previously declined to rate this version of the app?
|
||||
if ([userDefaults boolForKey:kAppiraterDeclinedToRate])
|
||||
return NO;
|
||||
|
||||
// has the user already rated the app?
|
||||
if ([self userHasRatedCurrentVersion])
|
||||
return NO;
|
||||
|
||||
// if the user wanted to be reminded later, has enough time passed?
|
||||
NSDate *reminderRequestDate = [NSDate dateWithTimeIntervalSince1970:[userDefaults doubleForKey:kAppiraterReminderRequestDate]];
|
||||
NSTimeInterval timeSinceReminderRequest = [[NSDate date] timeIntervalSinceDate:reminderRequestDate];
|
||||
NSTimeInterval timeUntilReminder = 60 * 60 * 24 * _timeBeforeReminding;
|
||||
if (timeSinceReminderRequest < timeUntilReminder)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)incrementUseCount {
|
||||
// get the app's version
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
|
||||
|
||||
// get the version number that we've been tracking
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *trackingVersion = [userDefaults stringForKey:kAppiraterCurrentVersion];
|
||||
if (trackingVersion == nil)
|
||||
{
|
||||
trackingVersion = version;
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
}
|
||||
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER Tracking version: %@", trackingVersion);
|
||||
|
||||
if ([trackingVersion isEqualToString:version])
|
||||
{
|
||||
// check if the first use date has been set. if not, set it.
|
||||
NSTimeInterval timeInterval = [userDefaults doubleForKey:kAppiraterFirstUseDate];
|
||||
if (timeInterval == 0)
|
||||
{
|
||||
timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
[userDefaults setDouble:timeInterval forKey:kAppiraterFirstUseDate];
|
||||
}
|
||||
|
||||
// increment the use count
|
||||
NSInteger useCount = [userDefaults integerForKey:kAppiraterUseCount];
|
||||
useCount++;
|
||||
[userDefaults setInteger:useCount forKey:kAppiraterUseCount];
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER Use count: %@", @(useCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a new version of the app, so restart tracking
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
[userDefaults setDouble:[[NSDate date] timeIntervalSince1970] forKey:kAppiraterFirstUseDate];
|
||||
[userDefaults setInteger:1 forKey:kAppiraterUseCount];
|
||||
[userDefaults setInteger:0 forKey:kAppiraterSignificantEventCount];
|
||||
[userDefaults setBool:NO forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults setBool:NO forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterReminderRequestDate];
|
||||
}
|
||||
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
- (void)incrementSignificantEventCount {
|
||||
// get the app's version
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
|
||||
|
||||
// get the version number that we've been tracking
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *trackingVersion = [userDefaults stringForKey:kAppiraterCurrentVersion];
|
||||
if (trackingVersion == nil)
|
||||
{
|
||||
trackingVersion = version;
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
}
|
||||
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER Tracking version: %@", trackingVersion);
|
||||
|
||||
if ([trackingVersion isEqualToString:version])
|
||||
{
|
||||
// check if the first use date has been set. if not, set it.
|
||||
NSTimeInterval timeInterval = [userDefaults doubleForKey:kAppiraterFirstUseDate];
|
||||
if (timeInterval == 0)
|
||||
{
|
||||
timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
[userDefaults setDouble:timeInterval forKey:kAppiraterFirstUseDate];
|
||||
}
|
||||
|
||||
// increment the significant event count
|
||||
NSInteger sigEventCount = [userDefaults integerForKey:kAppiraterSignificantEventCount];
|
||||
sigEventCount++;
|
||||
[userDefaults setInteger:sigEventCount forKey:kAppiraterSignificantEventCount];
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER Significant event count: %@", @(sigEventCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a new version of the app, so restart tracking
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterFirstUseDate];
|
||||
[userDefaults setInteger:0 forKey:kAppiraterUseCount];
|
||||
[userDefaults setInteger:1 forKey:kAppiraterSignificantEventCount];
|
||||
[userDefaults setBool:NO forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults setBool:NO forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterReminderRequestDate];
|
||||
}
|
||||
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
- (void)incrementAndRate:(BOOL)canPromptForRating {
|
||||
[self incrementUseCount];
|
||||
|
||||
if (canPromptForRating &&
|
||||
[self ratingConditionsHaveBeenMet] &&
|
||||
[self connectedToNetwork])
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
^{
|
||||
[self showRatingAlert];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)incrementSignificantEventAndRate:(BOOL)canPromptForRating {
|
||||
[self incrementSignificantEventCount];
|
||||
|
||||
if (canPromptForRating &&
|
||||
[self ratingConditionsHaveBeenMet] &&
|
||||
[self connectedToNetwork])
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
^{
|
||||
[self showRatingAlert];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)userHasDeclinedToRate {
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kAppiraterDeclinedToRate];
|
||||
}
|
||||
|
||||
- (BOOL)userHasRatedCurrentVersion {
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kAppiraterRatedCurrentVersion];
|
||||
}
|
||||
|
||||
+ (void)appLaunched {
|
||||
[Appirater appLaunched:YES];
|
||||
}
|
||||
|
||||
+ (void)appLaunched:(BOOL)canPromptForRating {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0),
|
||||
^{
|
||||
[[Appirater sharedInstance] incrementAndRate:canPromptForRating];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)hideRatingAlert {
|
||||
if (self.ratingAlert.visible) {
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER Hiding Alert");
|
||||
[self.ratingAlert dismissWithClickedButtonIndex:-1 animated:NO];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)appWillResignActive {
|
||||
if (_debug)
|
||||
NSLog(@"APPIRATER appWillResignActive");
|
||||
[[Appirater sharedInstance] hideRatingAlert];
|
||||
}
|
||||
|
||||
+ (void)appEnteredForeground:(BOOL)canPromptForRating {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0),
|
||||
^{
|
||||
[[Appirater sharedInstance] incrementAndRate:canPromptForRating];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)userDidSignificantEvent:(BOOL)canPromptForRating {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0),
|
||||
^{
|
||||
[[Appirater sharedInstance] incrementSignificantEventAndRate:canPromptForRating];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)showPrompt {
|
||||
[Appirater tryToShowPrompt];
|
||||
}
|
||||
|
||||
+ (void)tryToShowPrompt {
|
||||
[[Appirater sharedInstance] showPromptWithChecks:true
|
||||
displayRateLaterButton:true];
|
||||
}
|
||||
|
||||
+ (void)forceShowPrompt:(BOOL)displayRateLaterButton {
|
||||
[[Appirater sharedInstance] showPromptWithChecks:false
|
||||
displayRateLaterButton:displayRateLaterButton];
|
||||
}
|
||||
|
||||
- (void)showPromptWithChecks:(BOOL)withChecks
|
||||
displayRateLaterButton:(BOOL)displayRateLaterButton {
|
||||
bool showPrompt = true;
|
||||
if (withChecks) {
|
||||
showPrompt = ([self connectedToNetwork]
|
||||
&& ![self userHasDeclinedToRate]
|
||||
&& ![self userHasRatedCurrentVersion]);
|
||||
}
|
||||
if (showPrompt) {
|
||||
[self showRatingAlert:displayRateLaterButton];
|
||||
}
|
||||
}
|
||||
|
||||
+ (id)getRootViewController {
|
||||
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
|
||||
if (window.windowLevel != UIWindowLevelNormal) {
|
||||
NSArray *windows = [[UIApplication sharedApplication] windows];
|
||||
for(window in windows) {
|
||||
if (window.windowLevel == UIWindowLevelNormal) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (UIView *subView in [window subviews])
|
||||
{
|
||||
UIResponder *responder = [subView nextResponder];
|
||||
if([responder isKindOfClass:[UIViewController class]]) {
|
||||
return [self topMostViewController: (UIViewController *) responder];
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (UIViewController *) topMostViewController: (UIViewController *) controller {
|
||||
BOOL isPresenting = NO;
|
||||
do {
|
||||
// this path is called only on iOS 6+, so -presentedViewController is fine here.
|
||||
UIViewController *presented = [controller presentedViewController];
|
||||
isPresenting = presented != nil;
|
||||
if(presented != nil) {
|
||||
controller = presented;
|
||||
}
|
||||
|
||||
} while (isPresenting);
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
+ (void)rateApp {
|
||||
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
[userDefaults setBool:YES forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults synchronize];
|
||||
|
||||
//Use the in-app StoreKit view if available (iOS 6) and imported. This works in the simulator.
|
||||
if (![Appirater sharedInstance].openInAppStore && NSStringFromClass([SKStoreProductViewController class]) != nil) {
|
||||
|
||||
SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init];
|
||||
NSNumber *appId = [NSNumber numberWithInteger:_appId.integerValue];
|
||||
[storeViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier:appId} completionBlock:nil];
|
||||
storeViewController.delegate = self.sharedInstance;
|
||||
|
||||
id <AppiraterDelegate> delegate = self.sharedInstance.delegate;
|
||||
if ([delegate respondsToSelector:@selector(appiraterWillPresentModalView:animated:)]) {
|
||||
[delegate appiraterWillPresentModalView:self.sharedInstance animated:_usesAnimation];
|
||||
}
|
||||
[[self getRootViewController] presentViewController:storeViewController animated:_usesAnimation completion:^{
|
||||
[self setModalOpen:YES];
|
||||
//Temporarily use a black status bar to match the StoreKit view.
|
||||
[self setStatusBarStyle:[UIApplication sharedApplication].statusBarStyle];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
|
||||
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent animated:_usesAnimation];
|
||||
#endif
|
||||
}];
|
||||
|
||||
//Use the standard openUrl method if StoreKit is unavailable.
|
||||
} else {
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
NSLog(@"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
|
||||
#else
|
||||
NSString *reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", _appId]];
|
||||
|
||||
// iOS 7 needs a different templateReviewURL @see https://github.com/arashpayan/appirater/issues/131
|
||||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 7.1) {
|
||||
reviewURL = [templateReviewURLiOS7 stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", _appId]];
|
||||
}
|
||||
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:reviewURL]];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
id <AppiraterDelegate> delegate = _delegate;
|
||||
|
||||
switch (buttonIndex) {
|
||||
case 0:
|
||||
{
|
||||
// they don't want to rate it
|
||||
[userDefaults setBool:YES forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults synchronize];
|
||||
if(delegate && [delegate respondsToSelector:@selector(appiraterDidDeclineToRate:)]){
|
||||
[delegate appiraterDidDeclineToRate:self];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// they want to rate it
|
||||
[Appirater rateApp];
|
||||
if(delegate&& [delegate respondsToSelector:@selector(appiraterDidOptToRate:)]){
|
||||
[delegate appiraterDidOptToRate:self];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
// remind them later
|
||||
[userDefaults setDouble:[[NSDate date] timeIntervalSince1970] forKey:kAppiraterReminderRequestDate];
|
||||
[userDefaults synchronize];
|
||||
if(delegate && [delegate respondsToSelector:@selector(appiraterDidOptToRemindLater:)]){
|
||||
[delegate appiraterDidOptToRemindLater:self];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Delegate call from the StoreKit view.
|
||||
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
|
||||
[Appirater closeModal];
|
||||
}
|
||||
|
||||
//Close the in-app rating (StoreKit) view and restore the previous status bar style.
|
||||
+ (void)closeModal {
|
||||
if (_modalOpen) {
|
||||
[[UIApplication sharedApplication]setStatusBarStyle:_statusBarStyle animated:_usesAnimation];
|
||||
BOOL usedAnimation = _usesAnimation;
|
||||
[self setModalOpen:NO];
|
||||
|
||||
// get the top most controller (= the StoreKit Controller) and dismiss it
|
||||
UIViewController *presentingController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
presentingController = [self topMostViewController: presentingController];
|
||||
[presentingController dismissViewControllerAnimated:_usesAnimation completion:^{
|
||||
id <AppiraterDelegate> delegate = self.sharedInstance.delegate;
|
||||
if ([delegate respondsToSelector:@selector(appiraterDidDismissModalView:animated:)]) {
|
||||
[delegate appiraterDidDismissModalView:(Appirater *)self animated:usedAnimation];
|
||||
}
|
||||
}];
|
||||
[self.class setStatusBarStyle:(UIStatusBarStyle)nil];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,15 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'Appirater'
|
||||
s.version = '2.0.3'
|
||||
s.ios.deployment_target = '5.0'
|
||||
s.summary = "A utility that reminds your iPhone app's users to review the app."
|
||||
s.homepage = 'http://arashpayan.com/blog/2009/09/07/presenting-appirater/'
|
||||
s.author = { 'Arash Payan' => 'arash.payan@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/arashpayan/appirater.git', :tag => '2.0.3' }
|
||||
s.source_files = '*.{h,m}'
|
||||
s.resource_bundles = { 'Appirater' => ['*.lproj'] }
|
||||
s.requires_arc = true
|
||||
s.frameworks = 'CFNetwork', 'SystemConfiguration'
|
||||
s.weak_framework = 'StoreKit'
|
||||
s.license = { :type => 'MIT', :text => 'Copyright 2013. Arash Payan. This library is distributed under the terms of the MIT/X11.' }
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// AppiraterDelegate.h
|
||||
// Banana Stand
|
||||
//
|
||||
// Created by Robert Haining on 9/25/12.
|
||||
// Copyright (c) 2012 News.me. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class Appirater;
|
||||
|
||||
@protocol AppiraterDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
-(void)appiraterDidDisplayAlert:(Appirater *)appirater;
|
||||
-(void)appiraterDidDeclineToRate:(Appirater *)appirater;
|
||||
-(void)appiraterDidOptToRate:(Appirater *)appirater;
|
||||
-(void)appiraterDidOptToRemindLater:(Appirater *)appirater;
|
||||
-(void)appiraterWillPresentModalView:(Appirater *)appirater animated:(BOOL)animated;
|
||||
-(void)appiraterDidDismissModalView:(Appirater *)appirater animated:(BOOL)animated;
|
||||
@end
|
||||
@@ -0,0 +1,102 @@
|
||||
Introduction
|
||||
------------
|
||||
Appirater is a class that you can drop into any iPhone app (iOS 4.0 or later) that will help remind your users
|
||||
to review your app on the App Store. The code is released under the MIT/X11, so feel free to
|
||||
modify and share your changes with the world. Read on below for how to get started. If you need any help using,
|
||||
the library check out the [Appirater group] [appiratergroup].
|
||||
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
###Cocoapods
|
||||
If you're new to Cocoapods [watch this](http://nsscreencast.com/episodes/5-cocoapods). To add Appirater to your app, add `pod "Appirater"` to your Podfile.
|
||||
|
||||
Cocoapods support is still experimental, and might not work in all use cases. If you experience problems, open an issue and install via Git submodule
|
||||
|
||||
###Git submodule
|
||||
1. Add the Appirater code into your project.
|
||||
2. If your project doesn't use ARC, add the `-fobjc-arc` compiler flag to `Appirater.m` in your target's Build Phases » Compile Sources section.
|
||||
3. Add the `CFNetwork`, `SystemConfiguration`, and `StoreKit` frameworks to your project. Be sure to **change Required to Optional** for StoreKit in your target's Build Phases » Link Binary with Libraries section.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
1. Appirater provides class methods to configure its behavior. See [`Appirater.h`] [Appirater.h] for more information.
|
||||
|
||||
```objc
|
||||
[Appirater setAppId:@"552035781"];
|
||||
[Appirater setDaysUntilPrompt:1];
|
||||
[Appirater setUsesUntilPrompt:10];
|
||||
[Appirater setSignificantEventsUntilPrompt:-1];
|
||||
[Appirater setTimeBeforeReminding:2];
|
||||
[Appirater setDebug:YES];
|
||||
```
|
||||
|
||||
2. Call `[Appirater setAppId:@"yourAppId"]` with the app id provided by Apple. A good place to do this is at the beginning of your app delegate's `application:didFinishLaunchingWithOptions:` method.
|
||||
3. Call `[Appirater appLaunched:YES]` at the end of your app delegate's `application:didFinishLaunchingWithOptions:` method.
|
||||
4. Call `[Appirater appEnteredForeground:YES]` in your app delegate's `applicationWillEnterForeground:` method.
|
||||
5. (OPTIONAL) Call `[Appirater userDidSignificantEvent:YES]` when the user does something 'significant' in the app.
|
||||
|
||||
###Development
|
||||
Setting `[Appirater setDebug:YES]` will ensure that the rating request is shown each time the app is launched.
|
||||
|
||||
###Production
|
||||
Make sure you set `[Appirater setDebug:NO]` to ensure the request is not shown every time the app is launched. Also make sure that each of these components are set in the `application:didFinishLaunchingWithOptions:` method.
|
||||
|
||||
This example states that the rating request is only shown when the app has been launched 5 times **and** after 7 days.
|
||||
|
||||
```objc
|
||||
[Appirater setAppId:@"770699556"];
|
||||
[Appirater setDaysUntilPrompt:7];
|
||||
[Appirater setUsesUntilPrompt:5];
|
||||
[Appirater setSignificantEventsUntilPrompt:-1];
|
||||
[Appirater setTimeBeforeReminding:2];
|
||||
[Appirater setDebug:NO];
|
||||
[Appirater appLaunched:YES];
|
||||
```
|
||||
|
||||
If you wanted to show the request after 5 days only you can set the following:
|
||||
|
||||
```objc
|
||||
[Appirater setAppId:@"770699556"];
|
||||
[Appirater setDaysUntilPrompt:5];
|
||||
[Appirater setUsesUntilPrompt:0];
|
||||
[Appirater setSignificantEventsUntilPrompt:-1];
|
||||
[Appirater setTimeBeforeReminding:2];
|
||||
[Appirater setDebug:NO];
|
||||
[Appirater appLaunched:YES];
|
||||
```
|
||||
|
||||
Help and Support Group
|
||||
----------------------
|
||||
Requests for help, questions about usage, suggestions and other relevant topics should be posted at the [Appirater group] [appiratergroup]. As much as I'd like to help everyone who emails me, I can't respond to private emails, but I'll respond to posts on the group where others can benefit from the Q&As.
|
||||
|
||||
License
|
||||
-------
|
||||
Copyright 2013. [Arash Payan] [arash].
|
||||
This library is distributed under the terms of the MIT/X11.
|
||||
|
||||
While not required, I greatly encourage and appreciate any improvements that you make
|
||||
to this library be contributed back for the benefit of all who use Appirater.
|
||||
|
||||
Tips
|
||||
----
|
||||
Bitcoin tips are welcome: 1PxVtrzR4oHEKPojVx41JJnWGuPLggYDQy
|
||||
|
||||
Ports for other SDKs
|
||||
--------------
|
||||
A few people have ported Appirater to other SDKs. The ports are listed here in hopes that they may assist developers of those SDKs. I don't know how closesly (if at all) they track the Objective-C version of Appirater. If you need support for any of the libraries, please contact the maintainer of the port.
|
||||
|
||||
+ MonoTouch Port (using C#). [Github] [monotouchport]
|
||||
+ MonoTouch Binding (using native Appirater). [Github] [monotouchbinding]
|
||||
+ Corona SDK. [Github] [coronasdkport]
|
||||
+ Titanium SDK. [Github] [titaniumport]
|
||||
|
||||
[appiratergroup]: http://groups.google.com/group/appirater
|
||||
[homepage]: http://arashpayan.com/blog/index.php/2009/09/07/presenting-appirater/
|
||||
[arash]: http://arashpayan.com
|
||||
[Appirater.h]: https://github.com/arashpayan/appirater/blob/master/Appirater.h
|
||||
[monotouchport]: https://github.com/chebum/Appirater-for-MonoTouch
|
||||
[monotouchbinding]: https://github.com/theonlylawislove/MonoTouch.Appirater
|
||||
[coronasdkport]: https://github.com/aliasgar84/Appirater
|
||||
[titaniumport]: https://github.com/mpociot/TiAppirater
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "إذا كنت تستمع باستخدام %@، فهل تمانع بأن تأخذ دقيقة من وقتك لتقيمه؟ لن يستغرق الأمر أكثر من دقيقة. شكرا لدعمك!";
|
||||
"Rate %@" = "قيم %@";
|
||||
"No, Thanks" = "لا شكرا";
|
||||
"Remind me later" = "ذكرني لاحقا";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Si li agrada utilitzar %@, li importaria prendre’s un moment per a valorar-lo? No trigarà més d’un minut. Gràcies por la seva col·laboració!";
|
||||
"Rate %@" = "Valorar %@";
|
||||
"No, Thanks" = "No, gràcies";
|
||||
"Remind me later" = "Recordar-m’ho més tard";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Pokud se Vám aplikace %@ líbí, mohli byste ji prosím ohodnotit v App Store? Zabere to jen chvilku. Díky za Vaši podporu!";
|
||||
"Rate %@" = "Ohodnotit %@";
|
||||
"No, Thanks" = "Ne, díky";
|
||||
"Remind me later" = "Možná později";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Hvis du synes om at bruge %@, vil du have noget imod at bruge et kort øjeblik på at bedømme det? Det tager kun et minut. Tak for din støtte!";
|
||||
"Rate %@" = "Bedøm %@";
|
||||
"No, Thanks" = "Nej tak";
|
||||
"Remind me later" = "Påmind mig senere";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Sie nutzen %@ gerne? Dann nehmen Sie sich bitte für eine Bewertung einen Moment Zeit! Es dauert nicht länger als eine Minute. Vielen Dank!";
|
||||
"Rate %@" = "Bewerte %@";
|
||||
"No, Thanks" = "Nein, danke";
|
||||
"Remind me later" = "Später erinnern";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Αν σου αρέσει το %@, θα μπορούσες να αφιερώσεις μια στιγμή για να το βαθμολογήσεις; Η διαδικασία είναι πολύ σύντομη. Ευχαριστούμε για τη στήριξη!";
|
||||
"Rate %@" = "Βαθμολόγηση του %@";
|
||||
"No, Thanks" = "Όχι, ευχαριστώ";
|
||||
"Remind me later" = "Υπενθύμιση αργότερα";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!";
|
||||
"Rate %@" = "Rate %@";
|
||||
"No, Thanks" = "No, thanks";
|
||||
"Remind me later" = "Remind me later";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Si le gusta utilizar %@, ¿le importaría valorarlo? No le llevará más de un minuto. ¡Gracias por su colaboración!";
|
||||
"Rate %@" = "Valorar %@";
|
||||
"No, Thanks" = "No, gracias";
|
||||
"Remind me later" = "Recordar más tarde";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Jos käytät mielelläsi %@, voisitko käyttää hetken ja arvostella sen? Se ei kestä minuuttia kauempaa. Kiitos tuestasi!";
|
||||
"Rate %@" = "Arvioi %@";
|
||||
"No, Thanks" = "Ei kiitos";
|
||||
"Remind me later" = "Muistuta minua myöhemmin";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Si vous aimez %@, voulez-vous prendre un moment pour l'évaluer ? Cela ne vous prendra pas plus d'une minute. Merci de votre soutien !";
|
||||
"Rate %@" = "Évaluer %@";
|
||||
"No, Thanks" = "Non, merci";
|
||||
"Remind me later" = "Me rappeler plus tard";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "אם נהנת להשתמש ב %@, האם תסכים לדרג אותה? זה לא יקח יותר מדקה. תודה על התמיכה!";
|
||||
"Rate %@" = "דרג את %@";
|
||||
"No, Thanks" = "לא תודה";
|
||||
"Remind me later" = "מאוחר יותר";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Ha tetszik a %@, ne felejtsd el értékelni az App Store-ban! Csak egy perc az egész. Köszönet a támogatásért!";
|
||||
"Rate %@" = "%@ értékelése";
|
||||
"No, Thanks" = "Most inkább nem";
|
||||
"Remind me later" = "Emlékeztess később";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Jika anda menyukai %@, maukah anda memberikan rating kepada aplikasi ini? Rating hanya memakan waktu kurang dari 1 menit. Terimakasih untuk dukungan anda!";
|
||||
"Rate %@" = "Rating %@";
|
||||
"No, Thanks" = "Tidak, terimakasih";
|
||||
"Remind me later" = "Silakan ingatkan saya lagi";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Se ti piace %@, perché non dedichi qualche istante a darne una valutazione sull'App Store? Non richiederà più di un minuto. Grazie per il supporto!";
|
||||
"Rate %@" = "Valuta %@";
|
||||
"No, Thanks" = "No, grazie";
|
||||
"Remind me later" = "Ricordamelo più tardi";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "楽しんでいただけたならば簡単なご意見をお願いします。%@を評価しますか?";
|
||||
"Rate %@" = "%@の評価";
|
||||
"No, Thanks" ="いいえ";
|
||||
"Remind me later" = "後で見る";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "%@ 사용이 맘에 드셨나요? 잠시만 시간을 내서 평가를 부탁드리겠습니다. 감사합니다!";
|
||||
"Rate %@" = "%@ 평가하기";
|
||||
"No, Thanks" = "평가하지 않겠습니다";
|
||||
"Remind me later" = "다음에 평가하겠습니다";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Jika anda suka %@, bolehkah luangkan sedikit masa untuk beri penarafan? Tak sampai seminit pun. Terima kasih atas sokongan anda!";
|
||||
"Rate %@" = "Tarafkan %@";
|
||||
"No, Thanks" = "Terima kasih saja";
|
||||
"Remind me later" = "Ingatkan saya lain kali";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Hvis du liker å bruke %@, kan du ta deg et øyeblikk for å vurdere den? Det vil ikke ta mer enn ett minutt. Takk for din støtte!";
|
||||
"Rate %@" = "Vurder %@";
|
||||
"No, Thanks" = "Nei, takk";
|
||||
"Remind me later" = "Påminn meg senere";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Als het gebruik van %@ je bevalt, zou je dan een momentje de tijd willen nemen om het te beoordelen? Het duurt nog geen minuut. Bedankt voor je steun!";
|
||||
"Rate %@" = "%@ beoordelen";
|
||||
"No, Thanks" = "Nee, bedankt";
|
||||
"Remind me later" = "Herinner me er later aan";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Jeżeli podoba Ci się korzystanie z %@, może zechciałbyś poświęcić chwilę czasu, aby ocenić aplikację? Nie zajmie Ci to więcej niż minutę. Dziękujemy za pomoc!";␍
|
||||
"Rate %@" = "Oceń %@";␍
|
||||
"No, Thanks" = "Nie, dziękuję";␍
|
||||
"Remind me later" = "Przypomnij później";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Se você gosta de usar o %@, que tal avaliá-lo? Não levará mais de um minuto. Agradecemos o seu apoio!";
|
||||
"Rate %@" = "Avaliar o %@";
|
||||
"No, Thanks" = "Não, obrigado";
|
||||
"Remind me later" = "Mais tarde";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Se você gosta de usar o %@, que tal avaliá-lo? Não levará mais de um minuto. Agradecemos o seu apoio!";
|
||||
"Rate %@" = "Avaliar o %@";
|
||||
"No, Thanks" = "Não, obrigado";
|
||||
"Remind me later" = "Mais tarde";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Dacă îți place %@, acordă-i o notă te rog, nu durează mult. Mulțumim pentru susținere!";
|
||||
"Rate %@" = "Acordă notă pentru %@";
|
||||
"No, Thanks" = "Nu, mulțumesc";
|
||||
"Remind me later" = "Adu-mi aminte mai târziu";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Если Вам нравится %@, пожалуйста, поставьте свою оценку. Это займет у Вас не больше одной минуты.\n Спасибо за поддержку!";
|
||||
"Rate %@" = "Оценить %@";
|
||||
"No, Thanks" = "Нет, спасибо";
|
||||
"Remind me later" = "Напомнить позже";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Pokiaľ sa Vám páči aplikácia %@, mohli by ste ju prosím ohodnotiť v App Store? Zaberie to len chvíľu. Vďaka za Vašu podporu!";
|
||||
"Rate %@" = "Ohodnotiť %@";
|
||||
"No, Thanks" = "Nie, ďakujem";
|
||||
"Remind me later" = "Pripomenúť neskôr";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Om du gillar att använda %@, kan du tänka dig att betygsätta det åt oss? Det tar bara en minut. Tack för hjälpen!";
|
||||
"Rate %@" = "Betygsätt %@";
|
||||
"No, Thanks" = "Nej tack";
|
||||
"Remind me later" = "Påminn mig senare";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "ถ้าคุณกำลังใช้ %@ โปรดสละเวลาสักครู่ในการให้อันดับแก่เรา คุณจะเสียเวลาไม่เกินหนึ่งนาที ขอบคุณสำหรับการสนับสนุน!";
|
||||
"Rate %@" = "ให้อันดับ %@";
|
||||
"No, Thanks" = "ไม่ ขอบคุณ";
|
||||
"Remind me later" = "เตือนฉันภายหลัง";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Eğer %@ uygulamasını kullanmaktan keyif alıyorsanız, onu değerlendirmek için zaman ayırabilir misiniz? Desteğiniz için teşekkür ederiz!";
|
||||
"Rate %@" = "%@ uygulamasını değerlendir";
|
||||
"No, Thanks" = "Hayır, teşekkürler";
|
||||
"Remind me later" = "Daha sonra hatırlat";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Якщо вам сподобалося %@, будь ласка, поставте свою оцінку. Це займає не більше однієї хвилини.\n Дякуємо за підтримку!";
|
||||
"Rate %@" = "Оцінити %@";
|
||||
"No, Thanks" = "Ні, дякую";
|
||||
"Remind me later" = "Нагадати пізніше";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "Cảm ơn bạn đã sử dụng ứng dụng %@ trong thời gian qua, bạn có thể dành chút thời gian để đánh giá ứng dụng trong AppStore không?";
|
||||
"Rate %@" = "Đánh giá %@";
|
||||
"No, Thanks" = "Không, xin cảm ơn";
|
||||
"Remind me later" = "Hãy nhắc nhở tôi sau";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "如果你喜欢使用%@,你介意花一点时间给它评分吗?不会超过一分钟。感谢您的支持!";
|
||||
"Rate %@" = "给%@评分";
|
||||
"No, Thanks" = "不,谢谢";
|
||||
"Remind me later" = "稍后提醒我";
|
||||
@@ -0,0 +1,4 @@
|
||||
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "如果你喜歡使用%@,你介意花一點時間給它評分嗎?不會超過一分鐘。感謝您的支持!";
|
||||
"Rate %@" = "給%@評分";
|
||||
"No, Thanks" = "不,謝謝";
|
||||
"Remind me later" = "稍後提醒我";
|
||||
Reference in New Issue
Block a user