Apptentive.iOS 5.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Apptentive.iOS --version 5.0.0
NuGet\Install-Package Apptentive.iOS -Version 5.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Apptentive.iOS" Version="5.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Apptentive.iOS --version 5.0.0
#r "nuget: Apptentive.iOS, 5.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Apptentive.iOS as a Cake Addin
#addin nuget:?package=Apptentive.iOS&version=5.0.0

// Install Apptentive.iOS as a Cake Tool
#tool nuget:?package=Apptentive.iOS&version=5.0.0

Apptentive Xamarin iOS SDK

Register Apptentive

Register Apptentive in your Application class.

using ApptentiveSDK.iOS;

[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        ...
    
        var configuration = new ApptentiveConfiguration("Your Apptentive Key", "Your Apptentive Signature");
        Apptentive.Register(configuration);

        return true;
    }
}

Make sure you use the Apptentive App Key and Signature for the iOS app you created in the Apptentive console. Sharing these keys between two apps, or using keys from the wrong platform is not supported, and will lead to incorrect behavior. You can find them here.

Message Center

See: How to Use Message Center

Showing Message Center

Add Message Center to talk to your customers.

Find a place in your app where you can add a button that opens Message Center. Your setings page is a good place.

public partial class ViewController : UIViewController
{
    ...
    
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        MessageCenterButton.TouchUpInside += delegate
        {
            Apptentive.Shared.PresentMessageCenter(this, (presented) => Console.WriteLine("Message center presented: " + presented) );
        };
    }
}

Checking Unread Message Count

You can also check to see how many messages are waiting to be read in the customer’s Message Center.

var unreadMessageCount = Apptentive.Shared.UnreadMessageCount;
if (unreadMessageCount > 0)
{
    Console.WriteLine("You have {0} unread messages", unreadMessageCount);
}

Unread Message Count Notification

public partial class ViewController : UIViewController
{
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        
        ...
        
        NSNotificationCenter.DefaultCenter.AddObserver(Constants.ApptentiveMessageCenterUnreadCountChangedNotification, (NSNotification obj) =>
        {
            UnreadMessagesTextView.Text = "Unread messages: " + Apptentive.Shared.UnreadMessageCount;
        });
    }
}

Events

var engageButton = FindViewById<Button>(...);
engageButton.Click += delegate
{
    Apptentive.Shared.Engage("my_event", this, (engaged) => Console.WriteLine("Event engaged: " + engaged) ); // assuming 'this' is a ViewController
};

Push Notifications

To use Apptentive push, you will need to add code to your application delegate, configure your app for push in the developer portal, and supply your push certificate and private key in your Apptentive dashboard.

Configuring Your Application Delegate for Push

Your app will have to register for remote notifications (we recommend registering for alert and sound notifications) as follows:

var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Sound, new NSSet());

UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
UIApplication.SharedApplication.RegisterForRemoteNotifications();

When the registration succeeds, your application delegate will have to pass the device token on to the Apptentive SDK:

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
    Apptentive.Shared.SetPushNotificationIntegration(ApptentivePushProvider.Apptentive, deviceToken);
}

Your application delegate will also have to forward any push and local notifications that it receives to the Apptentive SDK:

public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
    Apptentive.Shared.DidReceiveRemoteNotification(userInfo, this.Window.RootViewController, completionHandler);
}

public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
{
    Apptentive.Shared.DidReceiveLocalNotification(notification, this.Window.RootViewController);
}

In place of this.Window.RootViewController, you should determine which of your app’s view controllers is currently being displayed and pass that in as the value for the from argument. You can pass nil for the view controller parameter and the SDK will create a new window to present Message Center in.

If you are using Apple’s UserNotifications framework, you will need to replace the second method listed above with the following:

public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
{
    Apptentive.Shared.DidReceveUserNotification(response, completionHandler);
}

If your app supports both Apptentive notifications and notifications from another source, the Apptentive "DidReceive" methods above return a boolean value that indicates that the notification was intended for the Apptentive SDK. For methods that accept a completionHandler, it will be called by the Apptentive SDK only if the notification is intended for it, so it is your app's responsibility to call the completion handler in the event that the Apptentive method returns false.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Apptentive.iOS:

Package Downloads
Plugin.Maui.Apptentive

Maui Plugin for Apptentive SDK

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.8.1 118 6/5/2024
6.7.2 141 4/26/2024
6.7.1.1 97 4/25/2024
6.7.1 81 4/24/2024
6.7.0 72 4/24/2024
6.1.0 33,329 2/9/2023
6.0.3.5 6,315 6/23/2022
6.0.3.4 437 6/23/2022
6.0.3.3 448 6/23/2022
6.0.3.2 438 6/23/2022
6.0.3.1 450 6/23/2022
6.0.3 426 6/22/2022
6.0.0.1 413 5/6/2022
6.0.0 436 5/5/2022
5.3.2 13,863 8/3/2021
5.3.1 5,059 9/16/2020
5.2.14 12,201 7/9/2020
5.2.8 4,847 9/19/2019
5.2.7 614 9/18/2019
5.2.6 646 9/6/2019
5.2.5 7,120 2/21/2019
5.2.4 736 2/18/2019
5.2.3 982 12/3/2018
5.1.0 5,652 5/14/2018
5.0.0 1,255 1/23/2018
4.1.0 1,685 11/9/2017