Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle id for iOS in Xamarin forms

How can I find bundle id and package name for iOS in a Xamarin forms app? I'm able to find the package name of Android in Android manifest but no clue about iOS.

like image 819
Judson Abraham Avatar asked Apr 11 '18 07:04

Judson Abraham


People also ask

Where to find iOS Bundle ID in Xcode?

Open you project with XCode, select the top project item in the project navigator at the left. Then select TARGETS -> General. Bundle Identifier is found under Identity.

Where to find Android Bundle ID?

The simplest method to look up an app's package ID is to find the app in Google Play Store using a web browser. The app package ID will be listed after 'id=' at the end of the URL. There are several Android apps available in Play Store that lets you find Package name IDs for apps published in Play Store.

How to read the bundle ID in Xamarin forms?

If you need to read your bundle id in code, you can add this property to a class in your Xamarin.Forms iOS project: Thanks @Dave Wood and for your answer. With Xamarin.Essentials: App Information you can get that info and displayed inside your app

How do I deploy a Xamarin app to an iOS device?

When set to Automatic, Visual Studio will select the identity and profile based on the Bundle Identifier in Info.plist. Click Run to deploy the app to your device. Apple provides a selection of special Application Services, also called capabilities, that can be activated for a Xamarin.iOS application.

How to give multi-device support in Xamarin forms?

How to give multi-device support in Xamarin Forms 1 one signal sdk setup for sending push notification to a particular registered android or ios device 16 Bundle id for iOS in Xamarin forms 1 DidReceiveRemoteNotification is not fired in background mode in Xamarin Forms

How to support iOS universal links in Xamarin forms?

When you press OPEN, the OnAppLinkRequestReceived -method in your Xamarin.Forms project should trigger and you’ll be able to handle the request inside your app. If you’re still having problems, follow these steps to troubleshoot universal links. There you have it, a very basic sample on how to support iOS Universal Links in Xamarin.Forms.


3 Answers

Bundle identifier is defined within a Info.plist under iOS project root.
This file is like AndroidManifest.xml on Android.

like image 156
EvZ Avatar answered Sep 20 '22 16:09

EvZ


Look inside your info.plist file. You'll see a key called CFBundleIdentifier and it's in there.

Here's an example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>My App Name</string>
    <key>CFBundleName</key>
    <string>MyBundleName</string>
    <key>CFBundleIdentifier</key>
    <string>com.example.myappidentifier</string>
    <key>CFBundleShortVersionString</key>
    <string>0.1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>MinimumOSVersion</key>
    <string>10.0</string>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/AppIcon.appiconset</string>
    <key>CFBundleVersion</key>
    <string>47</string>
</dict>
</plist>

Other interesting keys are CFBundleShortVersionString which have your app's version number (the marketing version number such as 1.0, 1.1.0 etc), and CFBundleVersion which include your build number (1, 2, 3, etc).

Also note: .plist files are an XML format. You'll notice the <dict> line that starts off a dictionary section. Inside that you'll see a series of <key>*</key> lines, each followed by a value for that key, which could be a simple type like a string, or a more complex type like an array or even another dictionary etc. When reading/editing a .plist file, the value for each key is right below the key. In this example, the CFBundleIdentifier has a value of com.example.myappidentifier.

If you need to read your bundle id in code, you can add this property to a class in your Xamarin.Forms iOS project:

public String BundleId => NSBundle.MainBundle.BundleIdentifier;
like image 45
Dave Wood Avatar answered Sep 18 '22 16:09

Dave Wood


With Xamarin.Essentials: App Information you can get that info and displayed inside your app

// Application Name
var appName = AppInfo.Name;

// Package Name/Application Identifier (com.microsoft.testapp)
var packageName = AppInfo.PackageName;

// Application Version (1.0.0)
var version = AppInfo.VersionString;

// Application Build Number (1)
var build = AppInfo.BuildString;

For further info take a look at this https://docs.microsoft.com/en-us/xamarin/essentials/app-information?context=xamarin%2Fxamarin-forms&tabs=android

like image 32
Jesús Jiménez Avatar answered Sep 18 '22 16:09

Jesús Jiménez