Apptentive.iOS
5.0.0
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
<PackageReference Include="Apptentive.iOS" Version="5.0.0" />
paket add Apptentive.iOS --version 5.0.0
#r "nuget: Apptentive.iOS, 5.0.0"
// 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
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.9.0 | 333 | 10/16/2024 | |
6.8.1 | 2,853 | 6/5/2024 | |
6.7.2 | 175 | 4/26/2024 | |
6.7.1.1 | 130 | 4/25/2024 | |
6.7.1 | 120 | 4/24/2024 | |
6.7.0 | 106 | 4/24/2024 | |
6.1.0 | 35,629 | 2/9/2023 | |
6.0.3.5 | 6,348 | 6/23/2022 | |
6.0.3.4 | 470 | 6/23/2022 | |
6.0.3.3 | 477 | 6/23/2022 | |
6.0.3.2 | 473 | 6/23/2022 | |
6.0.3.1 | 478 | 6/23/2022 | |
6.0.3 | 461 | 6/22/2022 | |
6.0.0.1 | 446 | 5/6/2022 | |
6.0.0 | 462 | 5/5/2022 | |
5.3.2 | 14,991 | 8/3/2021 | |
5.3.1 | 5,109 | 9/16/2020 | |
5.2.14 | 12,247 | 7/9/2020 | |
5.2.8 | 4,884 | 9/19/2019 | |
5.2.7 | 657 | 9/18/2019 | |
5.2.6 | 691 | 9/6/2019 | |
5.2.5 | 7,217 | 2/21/2019 | |
5.2.4 | 772 | 2/18/2019 | |
5.2.3 | 1,029 | 12/3/2018 | |
5.1.0 | 5,687 | 5/14/2018 | |
5.0.0 | 1,286 | 1/23/2018 | |
4.1.0 | 1,729 | 11/9/2017 |