Feb 22, 2007 1367 Posts. Re: Please specify the assembly explicitly in the type name May 18, 2005 08:03 PM davidebb LINK. Hi Jez, This is a bug that we found and fixed after Beta 2. It typically happens when you have pages in different directories that have the same code behind class name (here 'Default'), and you deploy the app. Overriding a PackageReference version. In some cases, you may need to override the version for a particular project. To do this, you must use the VersionOverride metadata. Having different versions in use in your tree can lead to undesired behavior and make diagnosing build errors more difficult.
-->The App Center SDK uses a modular architecture so you can use any or all of the services.
Let's get started with setting up App Center macOS SDK in your app to use App Center Analytics and App Center Crashes. To add App Center Push to you app, please have a look at the documentation for App Center Push.
1. Prerequisites
The following requirements must be met to use App Center SDK:
- Your macOS project is set up in Xcode 8 or later on macOS version 10.12 or later.
- You are targeting devices running on macOS 10.9 or later.
- You are not using any other library that provides Crash Reporting functionality.
Note
App Center SDK will drop support for Xcode 8 and 9 with the May SDK release. Please refer to this GitHub issue for more information.
2. Create your app in the App Center Portal to obtain the App Secret
If you have already created your app in the App Center portal, you can skip this step.
- Head over to appcenter.ms.
- Sign up or log in and hit the blue button on the top right corner of the portal that says Add new and select Add new app from the dropdown menu.
- Enter a name and an optional description for your app.
- Select macOS as the OS and Objective-C/Swift as a platform.
- Hit the button at the bottom right that says Add new app.
Once you have created an app, you can obtain its App Secret on the Settings page on the App Center Portal. At the top right hand corner of the Settings page, click on the triple vertical dots and select
Copy app secret
to get your App Secret.3. Add the App Center SDK modules
The App Center SDK for macOS can be integrated into your app via Cocoapods or by manually adding the binaries to your project.
3.1 Integration via Cocoapods
- Add the following dependencies to your
podfile
to include App Center Analytics and App Center Crashes into your app. This will pull in the following frameworks: AppCenter, AppCenterAnalytics and AppCenterCrashes. Alternatively, you can specify which services you want to use in your app. Each service has its own subspec and they all rely onAppCenter
. It will get pulled in automatically. - Run
pod install
to install your newly defined pod and open the project's .xcworkspace.
Now that you've integrated the frameworks in your application, it's time to start the SDK and make use of the App Center services.
3.2 Integration by copying the binaries into your project
Below are the steps on how to integrate the compiled binaries in your Xcode project to set up App Center Analytics and App Center Crashes for your macOS app.
- Download the App Center SDK frameworks provided as a zip file.
- Unzip the file and you will see a folder called AppCenter-SDK-Apple that contains different frameworks for each App Center service on each platform folder. The framework called
AppCenter
is required in the project as it contains code that is shared between the different modules. - [Optional] Create a subdirectory for 3rd-party libraries.
- As a best practice, 3rd-party libraries usually reside inside a subdirectory (it is often called Vendor), so if you don't have your project organized with a subdirectory for libraries, create a Vendor subdirectory now.
- Create a group called Vendor inside your Xcode project to mimic your file structure on disk.
- Open the unziped AppCenter-SDK-Apple folder in Finder and copy the folder into your project's folder at the location where you want it to reside. The folder contains frameworks in subfolders for other platforms that App Center SDK supports, so you might need to delete subfolders that you don't need.
- Add the SDK frameworks to the project in Xcode:
- Make sure the Project Navigator is visible (⌘+1).
- Now drag and drop AppCenter.framework, AppCenterAnalytics.framework and AppCenterCrashes.framework from the Finder (the ones inside the Vendor folder) into Xcode's Project Navigator. Note that AppCenter.framework is required to start the SDK, make sure it is added to your project, otherwise the other modules won't work and your app won't compile.
- A dialog will appear, make sure your app target is checked. Then click Finish.
Note
The SDK binary is not packaged following the macOS framework convention. The reason is that the App Center SDK for Mac is not a conventional framework but a static one. You have to link it as a static framework: make sure that you are not embedding the binaries, and don't include them in the 'copy bundle resources' build phase.
Now that you've integrated the frameworks in your application, it's time to start the SDK and make use of the App Center services.
4. Start the SDK
In order to use App Center, you must opt in to the module(s) that you want to use. By default no modules are started and you will have to explicitly call each of them when starting the SDK.
4.1 Add the import statements
Objective-C
Open the project's AppDelegate.m file and add the following import statements:
Swift
Open the project's AppDelegate.swift file and add the following import statements:
4.2 Add the start:withServices:
method
Objective-C
Insert the following line to start the SDK in the project's AppDelegate.m class in the
applicationDidFinishLaunching
method.Swift
Insert the following line to start the SDK in the project's AppDelegate.swift class in the
applicationDidFinishLaunching
method.4.3 Replace the placeholder with your App Secret
Make sure to replace
{Your App Secret}
text with the actual value for your application. The App Secret can be found on the Getting Started page or Settings page on the App Center portal.The Getting Started page contains the above code sample with your App Secret in it, you can just copy-paste the whole sample.
The example above shows how to use the
start:withServices
method and include both App Center Analytics and App Center Crashes.If you do not want to use one of the two services, remove the corresponding parameter from the method call above.
Note that, unless you explicitly specify each module as parameters in the start method, you can't use that App Center service. In addition, the
start:withServices
API can be used only once in the lifecycle of your app – all other calls will log a warning to the console and only the modules included in the first call will be available.For example - If you just want to onboard to App Center Analytics, you should modify the
start:withServices
API call as follows:Objective-C
Swift
4.4 Add internet capabilities for sandboxed apps
If your app is using the App Sandbox, you have to set the capability to allow outgoing (Client) connections to allow the app to have access to the internet.Xcode 9 enables the App Sandbox by default but the capabilities for outgoing connections need to be set explicitly.
Select your project in the project navigator, select the Capabilities tab and if your app is using the sandbox, enable outgoing connections.
Note
If your app has App Center Push enabled, incoming (Server) connections has to be set as well.
Great, you are all set to visualize Analytics and Crashes data on the portal that the SDK collects automatically.
Look at the documentation for App Center Analytics and App Center Crashes to learn how to customize and use more advanced functionalities of both services.
To learn how to get started with Push, read the documentation of App Center Push.