Merge remote-tracking branch 'origin/develop' into feature/add-crash-probe-cases

# Conflicts:
#	Puppet/Puppet.xcodeproj/project.pbxproj
This commit is contained in:
Benjamin Scholtysik (Reimold) 2016-11-21 13:48:09 -08:00
Родитель 1e4127a343 0d688e0079
Коммит e0912a4f28
45 изменённых файлов: 1601 добавлений и 127 удалений

Просмотреть файл

@ -10,6 +10,13 @@
04CCCA441D88AA86005D8180 /* MobileCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA431D88AA86005D8180 /* MobileCenter.framework */; };
04CCCA461D88AA93005D8180 /* MobileCenterAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA451D88AA93005D8180 /* MobileCenterAnalytics.framework */; };
04CCCA481D88AA9F005D8180 /* MobileCenterCrashes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA471D88AA9F005D8180 /* MobileCenterCrashes.framework */; };
382EC1DB1DDB805400A60DBD /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 382EC1DA1DDB805400A60DBD /* NotificationCenter.framework */; };
382EC1E61DDB805400A60DBD /* DemoWidget.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 382EC1D81DDB805400A60DBD /* DemoWidget.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
382EC1F91DDB9F7F00A60DBD /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 382EC1F71DDB9F7F00A60DBD /* TodayViewController.m */; };
382EC1FC1DDB9FA400A60DBD /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 382EC1FA1DDB9FA400A60DBD /* MainInterface.storyboard */; };
382EC2001DDBBB6800A60DBD /* MobileCenterCrashes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA471D88AA9F005D8180 /* MobileCenterCrashes.framework */; };
382EC2011DDBBB6800A60DBD /* MobileCenterAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA451D88AA93005D8180 /* MobileCenterAnalytics.framework */; };
382EC2021DDBBB6800A60DBD /* MobileCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04CCCA431D88AA86005D8180 /* MobileCenter.framework */; };
6E2307DA1D22083C0031C598 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2307D91D22083C0031C598 /* main.m */; };
6E2307DD1D22083C0031C598 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2307DC1D22083C0031C598 /* AppDelegate.m */; };
6E2307E01D22083C0031C598 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E2307DF1D22083C0031C598 /* ViewController.m */; };
@ -18,10 +25,40 @@
6E2307E81D22083C0031C598 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6E2307E61D22083C0031C598 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
382EC1E41DDB805400A60DBD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6E2307CD1D22083C0031C598 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 382EC1D71DDB805400A60DBD;
remoteInfo = DemoWidget;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
382EC1EA1DDB805400A60DBD /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
382EC1E61DDB805400A60DBD /* DemoWidget.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
04CCCA431D88AA86005D8180 /* MobileCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCenter.framework; path = ../Products/MobileCenter/MobileCenter.framework; sourceTree = "<group>"; };
04CCCA451D88AA93005D8180 /* MobileCenterAnalytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCenterAnalytics.framework; path = ../Products/MobileCenterAnalytics/MobileCenterAnalytics.framework; sourceTree = "<group>"; };
04CCCA471D88AA9F005D8180 /* MobileCenterCrashes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCenterCrashes.framework; path = ../Products/MobileCenterCrashes/MobileCenterCrashes.framework; sourceTree = "<group>"; };
382EC1D81DDB805400A60DBD /* DemoWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = DemoWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
382EC1DA1DDB805400A60DBD /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; };
382EC1E31DDB805400A60DBD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
382EC1F71DDB9F7F00A60DBD /* TodayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = "<group>"; };
382EC1F81DDB9F7F00A60DBD /* TodayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = "<group>"; };
382EC1FB1DDB9FA400A60DBD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
384959E81D49786A008F6B3A /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
6E2307D51D22083C0031C598 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
6E2307D91D22083C0031C598 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@ -36,6 +73,17 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
382EC1D51DDB805400A60DBD /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
382EC1DB1DDB805400A60DBD /* NotificationCenter.framework in Frameworks */,
382EC2001DDBBB6800A60DBD /* MobileCenterCrashes.framework in Frameworks */,
382EC2011DDBBB6800A60DBD /* MobileCenterAnalytics.framework in Frameworks */,
382EC2021DDBBB6800A60DBD /* MobileCenter.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
6E2307D21D22083C0031C598 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -49,11 +97,32 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
382EC1D91DDB805400A60DBD /* Frameworks */ = {
isa = PBXGroup;
children = (
382EC1DA1DDB805400A60DBD /* NotificationCenter.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
382EC1DC1DDB805400A60DBD /* DemoWidget */ = {
isa = PBXGroup;
children = (
382EC1F81DDB9F7F00A60DBD /* TodayViewController.h */,
382EC1F71DDB9F7F00A60DBD /* TodayViewController.m */,
382EC1FA1DDB9FA400A60DBD /* MainInterface.storyboard */,
382EC1E31DDB805400A60DBD /* Info.plist */,
);
path = DemoWidget;
sourceTree = "<group>";
};
6E2307CC1D22083C0031C598 = {
isa = PBXGroup;
children = (
6E2307EF1D2208670031C598 /* Vendor */,
6E2307D71D22083C0031C598 /* Demo */,
382EC1DC1DDB805400A60DBD /* DemoWidget */,
382EC1D91DDB805400A60DBD /* Frameworks */,
6E2307D61D22083C0031C598 /* Products */,
);
sourceTree = "<group>";
@ -62,6 +131,7 @@
isa = PBXGroup;
children = (
6E2307D51D22083C0031C598 /* Demo.app */,
382EC1D81DDB805400A60DBD /* DemoWidget.appex */,
);
name = Products;
sourceTree = "<group>";
@ -104,6 +174,23 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
382EC1D71DDB805400A60DBD /* DemoWidget */ = {
isa = PBXNativeTarget;
buildConfigurationList = 382EC1E91DDB805400A60DBD /* Build configuration list for PBXNativeTarget "DemoWidget" */;
buildPhases = (
382EC1D41DDB805400A60DBD /* Sources */,
382EC1D51DDB805400A60DBD /* Frameworks */,
382EC1D61DDB805400A60DBD /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = DemoWidget;
productName = DemoWidget;
productReference = 382EC1D81DDB805400A60DBD /* DemoWidget.appex */;
productType = "com.apple.product-type.app-extension";
};
6E2307D41D22083C0031C598 /* Demo */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6E2307EC1D22083C0031C598 /* Build configuration list for PBXNativeTarget "Demo" */;
@ -111,10 +198,12 @@
6E2307D11D22083C0031C598 /* Sources */,
6E2307D21D22083C0031C598 /* Frameworks */,
6E2307D31D22083C0031C598 /* Resources */,
382EC1EA1DDB805400A60DBD /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
382EC1E51DDB805400A60DBD /* PBXTargetDependency */,
);
name = Demo;
productName = Demo;
@ -131,6 +220,10 @@
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Microsoft;
TargetAttributes = {
382EC1D71DDB805400A60DBD = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = L4RARDNZ2Y;
};
6E2307D41D22083C0031C598 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = L4RARDNZ2Y;
@ -151,11 +244,20 @@
projectRoot = "";
targets = (
6E2307D41D22083C0031C598 /* Demo */,
382EC1D71DDB805400A60DBD /* DemoWidget */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
382EC1D61DDB805400A60DBD /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
382EC1FC1DDB9FA400A60DBD /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
6E2307D31D22083C0031C598 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -169,6 +271,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
382EC1D41DDB805400A60DBD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
382EC1F91DDB9F7F00A60DBD /* TodayViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
6E2307D11D22083C0031C598 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -181,7 +291,23 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
382EC1E51DDB805400A60DBD /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 382EC1D71DDB805400A60DBD /* DemoWidget */;
targetProxy = 382EC1E41DDB805400A60DBD /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
382EC1FA1DDB9FA400A60DBD /* MainInterface.storyboard */ = {
isa = PBXVariantGroup;
children = (
382EC1FB1DDB9FA400A60DBD /* Base */,
);
name = MainInterface.storyboard;
sourceTree = "<group>";
};
6E2307E11D22083C0031C598 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
@ -201,6 +327,32 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
382EC1E71DDB805400A60DBD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DemoWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.azure.mobile.demo.DemoWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
382EC1E81DDB805400A60DBD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = "$(inherited)/**";
INFOPLIST_FILE = DemoWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.azure.mobile.demo.DemoWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
6E2307EA1D22083C0031C598 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -226,6 +378,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../MobileCenter-SDK-iOS";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@ -273,6 +426,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../MobileCenter-SDK-iOS";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -295,10 +449,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/../MobileCenter-SDK-iOS/**",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Demo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -313,10 +464,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/../MobileCenter-SDK-iOS/**",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Demo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -328,6 +476,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
382EC1E91DDB805400A60DBD /* Build configuration list for PBXNativeTarget "DemoWidget" */ = {
isa = XCConfigurationList;
buildConfigurations = (
382EC1E71DDB805400A60DBD /* Debug */,
382EC1E81DDB805400A60DBD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6E2307D01D22083C0031C598 /* Build configuration list for PBXProject "Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (

Просмотреть файл

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E04017D1D1CAC710051BCFA"
BuildableName = "MobileCenterFramework"
BlueprintName = "MobileCenterFramework"
ReferencedContainer = "container:../MobileCenter/MobileCenter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E85547E41D2D681F002DF6E2"
BuildableName = "MobileCenterAnalyticsFramework"
BlueprintName = "MobileCenterAnalyticsFramework"
ReferencedContainer = "container:../MobileCenterAnalytics/MobileCenterAnalytics.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E3729771D1DE83200F1E4AE"
BuildableName = "MobileCenterCrashesFramework"
BlueprintName = "MobileCenterCrashesFramework"
ReferencedContainer = "container:../MobileCenterCrashes/MobileCenterCrashes.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "382EC1D71DDB805400A60DBD"
BuildableName = "DemoWidget.appex"
BlueprintName = "DemoWidget"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E2307D41D22083C0031C598"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E2307D41D22083C0031C598"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "xcodebuild build -project ../MobileCenter/MobileCenter.xcodeproj -scheme MobileCenterFramework&#10;xcodebuild build -project ../MobileCenterAnalytics/MobileCenterAnalytics.xcodeproj -scheme MobileCenterAnalyticsFramework&#10;xcodebuild build -project ../MobileCenterCrashes/MobileCenterCrashes.xcodeproj -scheme MobileCenterCrashesFramework"
shellToInvoke = "/bin/sh">
</ActionContent>
</ExecutionAction>
</PreActions>
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.springboard"
RemotePath = "/Today">
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E2307D41D22083C0031C598"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E2307D41D22083C0031C598"
BuildableName = "Demo.app"
BlueprintName = "Demo"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
@ -15,7 +16,6 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>

Просмотреть файл

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="M4Y-Lb-cyx">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Today View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ft6-oW-KC0"/>
<viewControllerLayoutGuide type="bottom" id="FKl-LY-JtV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Demo Widget" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="GcN-lo-r42">
<rect key="frame" x="20" y="8" width="280" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="0.59999999999999998" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qge-BY-5CJ">
<rect key="frame" x="208" y="43" width="41" height="30"/>
<state key="normal" title="Crash"/>
<connections>
<action selector="crashClick:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="7Yc-U3-cOF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QLI-NU-BiA">
<rect key="frame" x="60" y="43" width="77" height="30"/>
<state key="normal" title="TrackEvent"/>
<connections>
<action selector="trackEventClick:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="1o5-Eh-GE8"/>
</connections>
</button>
</subviews>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="100"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="516" y="285"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -0,0 +1,33 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>DemoWidget</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widget-extension</string>
</dict>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,9 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <UIKit/UIKit.h>
@interface TodayViewController : UIViewController
@end

Просмотреть файл

@ -0,0 +1,56 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
@import MobileCenter;
@import MobileCenterAnalytics;
@import MobileCenterCrashes;
#import "TodayViewController.h"
#import <NotificationCenter/NotificationCenter.h>
@interface TodayViewController () <NCWidgetProviding>
@end
static BOOL MobileCenterSDKIsSarted = NO;
@implementation TodayViewController
- (void)viewDidLoad {
[super viewDidLoad];
if (!MobileCenterSDKIsSarted) {
[MSMobileCenter setLogLevel:MSLogLevelVerbose];
[MSMobileCenter start:@"7dfb022a-17b5-4d4a-9c75-12bc3ef5e6b7"
withServices:@[ [MSAnalytics class], [MSCrashes class] ]];
MobileCenterSDKIsSarted = YES;
}
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResultFailed
// If there's no update required, use NCUpdateResultNoData
// If there's an update, use NCUpdateResultNewData
completionHandler(NCUpdateResultNewData);
}
- (IBAction)trackEventClick:(id)sender {
[MSAnalytics trackEvent:@"test"];
}
- (IBAction)crashClick:(id)sender {
/* Trigger a crash */
NSArray *array = [NSArray array];
[array objectAtIndex:23];
}
@end

Просмотреть файл

@ -38,8 +38,12 @@
355D1E3C1DC009EB00DDAD38 /* MSWrapperLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 355D1E371DBFEB0900DDAD38 /* MSWrapperLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };
3592ABA71DC90E3600EF4592 /* MSLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 3592ABA51DC90E3600EF4592 /* MSLogger.h */; };
3592ABA81DC90E3600EF4592 /* MSLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 3592ABA61DC90E3600EF4592 /* MSLogger.m */; };
380A4DCB1DD6908A00E99219 /* MSApplicationHelperTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 380A4DCA1DD6908A00E99219 /* MSApplicationHelperTests.m */; };
381C91E91D3DB65D004512F1 /* MSDeviceTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 381C91E51D3DB65D004512F1 /* MSDeviceTracker.h */; };
381C91EA1D3DB65D004512F1 /* MSDeviceTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 381C91E61D3DB65D004512F1 /* MSDeviceTracker.m */; };
382EC2051DDBC0AC00A60DBD /* MSApplicationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 382EC2031DDBC0AC00A60DBD /* MSApplicationHelper.m */; };
382EC2061DDBC0AC00A60DBD /* MSApplicationHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 382EC2041DDBC0AC00A60DBD /* MSApplicationHelper.h */; };
382EC2071DDBC32B00A60DBD /* MSApplicationHelperPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F7C4111DDA2169001D86EF /* MSApplicationHelperPrivate.h */; };
384772A61DA5691F009365DE /* MSSenderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 384772A51DA5691F009365DE /* MSSenderDelegate.h */; };
384959D51D491D4F008F6B3A /* MSMobileCenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 384959D41D491D4F008F6B3A /* MSMobileCenterTest.m */; };
385AD9221D95898D008B354A /* MSServiceAbstractProtected.h in Headers */ = {isa = PBXBuildFile; fileRef = 385AD9211D95898D008B354A /* MSServiceAbstractProtected.h */; };
@ -52,6 +56,7 @@
387C76FD1D6C9CF100D68CC1 /* MSServiceAbstract.h in Headers */ = {isa = PBXBuildFile; fileRef = 387C76FC1D6C9CF100D68CC1 /* MSServiceAbstract.h */; settings = {ATTRIBUTES = (Public, ); }; };
389124281DC7ABB600197086 /* MSRetriableCallPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 389124271DC7ABB600197086 /* MSRetriableCallPrivate.h */; };
38CA60ED1D949F5000B82420 /* MSFileStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E40D4621D2700000046D85B /* MSFileStorage.m */; };
38E1B67A1DDE3FDF000EFED1 /* MSMobileCenterPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38E1B6791DDE3FDF000EFED1 /* MSMobileCenterPrivate.h */; };
38EAD9AC1DA6A8C500CE6030 /* MSEnable.h in Headers */ = {isa = PBXBuildFile; fileRef = 38EAD9AB1DA6A8C500CE6030 /* MSEnable.h */; };
38F1944E1DADB93100D3E0FE /* MSHttpSenderPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F1944D1DADB93100D3E0FE /* MSHttpSenderPrivate.h */; };
59493FB23FC790090683581A /* MSChannelDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5949380E604D45340244FEF1 /* MSChannelDelegate.h */; };
@ -167,8 +172,11 @@
355D1E3A1DBFFB7E00DDAD38 /* MSWrapperLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSWrapperLogger.m; sourceTree = "<group>"; };
3592ABA51DC90E3600EF4592 /* MSLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSLogger.h; sourceTree = "<group>"; };
3592ABA61DC90E3600EF4592 /* MSLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSLogger.m; sourceTree = "<group>"; };
380A4DCA1DD6908A00E99219 /* MSApplicationHelperTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSApplicationHelperTests.m; sourceTree = "<group>"; };
381C91E51D3DB65D004512F1 /* MSDeviceTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSDeviceTracker.h; sourceTree = "<group>"; };
381C91E61D3DB65D004512F1 /* MSDeviceTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSDeviceTracker.m; sourceTree = "<group>"; };
382EC2031DDBC0AC00A60DBD /* MSApplicationHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSApplicationHelper.m; sourceTree = "<group>"; };
382EC2041DDBC0AC00A60DBD /* MSApplicationHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSApplicationHelper.h; sourceTree = "<group>"; };
384772A51DA5691F009365DE /* MSSenderDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSSenderDelegate.h; sourceTree = "<group>"; };
384959D41D491D4F008F6B3A /* MSMobileCenterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSMobileCenterTest.m; sourceTree = "<group>"; };
385AD9211D95898D008B354A /* MSServiceAbstractProtected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSServiceAbstractProtected.h; sourceTree = "<group>"; };
@ -180,8 +188,10 @@
387C76D91D677EC100D68CC1 /* MSServiceAbstractPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSServiceAbstractPrivate.h; sourceTree = "<group>"; };
387C76FC1D6C9CF100D68CC1 /* MSServiceAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSServiceAbstract.h; sourceTree = "<group>"; };
389124271DC7ABB600197086 /* MSRetriableCallPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSRetriableCallPrivate.h; sourceTree = "<group>"; };
38E1B6791DDE3FDF000EFED1 /* MSMobileCenterPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSMobileCenterPrivate.h; sourceTree = "<group>"; };
38EAD9AB1DA6A8C500CE6030 /* MSEnable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSEnable.h; sourceTree = "<group>"; };
38F1944D1DADB93100D3E0FE /* MSHttpSenderPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSHttpSenderPrivate.h; sourceTree = "<group>"; };
38F7C4111DDA2169001D86EF /* MSApplicationHelperPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSApplicationHelperPrivate.h; sourceTree = "<group>"; };
5949380E604D45340244FEF1 /* MSChannelDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSChannelDelegate.h; sourceTree = "<group>"; };
6E0401031D1C98220051BCFA /* libMobileCenter.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMobileCenter.a; sourceTree = BUILT_PRODUCTS_DIR; };
6E04013F1D1C99AC0051BCFA /* MSConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSConstants.h; sourceTree = "<group>"; };
@ -232,7 +242,7 @@
6E3E2C9D1D35701000B1EE50 /* MSLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSLog.h; sourceTree = "<group>"; };
6E3E2CC01D3596AE00B1EE50 /* MSDeviceLogTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSDeviceLogTests.m; sourceTree = "<group>"; };
6E40D4611D2700000046D85B /* MSFileStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSFileStorage.h; sourceTree = "<group>"; };
6E40D4621D2700000046D85B /* MSFileStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSFileStorage.m; sourceTree = "<group>"; };
6E40D4621D2700000046D85B /* MSFileStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MSFileStorage.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
6E48A5A31D3831FE006E8B5F /* MSChannelConfigurationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSChannelConfigurationTests.m; sourceTree = "<group>"; };
6E48A5A61D383893006E8B5F /* MSLogManagerDefaultTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSLogManagerDefaultTests.m; sourceTree = "<group>"; };
6E58E2B61D2F12A70039D062 /* MSStorageBucketTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSStorageBucketTests.m; sourceTree = "<group>"; };
@ -275,12 +285,12 @@
E8831A991D41A58600931F11 /* MSDeviceTrackerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSDeviceTrackerPrivate.h; sourceTree = "<group>"; };
E88D17041D35B6B500A5EA57 /* MSMockLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSMockLog.h; sourceTree = "<group>"; };
E88D17051D35B6B500A5EA57 /* MSMockLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSMockLog.m; sourceTree = "<group>"; };
E88D170D1D36BB1700A5EA57 /* MSUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSUtils.h; sourceTree = "<group>"; };
E88D170D1D36BB1700A5EA57 /* MSUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MSUtils.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
E88EBBEA1D2C612E007E7785 /* MSAbstractLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSAbstractLog.h; sourceTree = "<group>"; };
E88EBBEB1D2C612E007E7785 /* MSAbstractLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSAbstractLog.m; sourceTree = "<group>"; };
E88EBBF71D2C717D007E7785 /* MSLogUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSLogUtils.h; sourceTree = "<group>"; };
E88EBBF81D2C717D007E7785 /* MSLogUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSLogUtils.m; sourceTree = "<group>"; };
E88EBBFA1D2C8CC7007E7785 /* MSLogContainerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSLogContainerTests.m; sourceTree = "<group>"; };
E88EBBFA1D2C8CC7007E7785 /* MSLogContainerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MSLogContainerTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
E8A8D1E91D3057A90022931E /* MSUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MSUserDefaults.h; path = ../Model/Utils/MSUserDefaults.h; sourceTree = "<group>"; };
E8A8D1EA1D3057A90022931E /* MSUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MSUserDefaults.m; path = ../Model/Utils/MSUserDefaults.m; sourceTree = "<group>"; };
E8AEE9811D5970A400C0FF6C /* MSLogManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSLogManagerDelegate.h; sourceTree = "<group>"; };
@ -373,6 +383,7 @@
3592ABA61DC90E3600EF4592 /* MSLogger.m */,
6E0401581D1C9CFB0051BCFA /* MobileCenter+Internal.h */,
6E0401441D1C99AC0051BCFA /* MSMobileCenterInternal.h */,
38E1B6791DDE3FDF000EFED1 /* MSMobileCenterPrivate.h */,
E83283C21D46C62E000B029E /* Vendor */,
381C91E21D3DB65D004512F1 /* Device */,
E84B8E241D234EC7006FD231 /* Channel */,
@ -387,6 +398,9 @@
6E0401481D1C99AC0051BCFA /* Utils */ = {
isa = PBXGroup;
children = (
382EC2031DDBC0AC00A60DBD /* MSApplicationHelper.m */,
382EC2041DDBC0AC00A60DBD /* MSApplicationHelper.h */,
38F7C4111DDA2169001D86EF /* MSApplicationHelperPrivate.h */,
B22FC2B41D5E51A20007CD80 /* MSEnvironmentHelper.h */,
B22FC2B51D5E51A20007CD80 /* MSEnvironmentHelper.m */,
E88D170D1D36BB1700A5EA57 /* MSUtils.h */,
@ -496,6 +510,7 @@
384959D41D491D4F008F6B3A /* MSMobileCenterTest.m */,
387C75951D64EE1900D68CC1 /* MSServiceAbstractTest.m */,
B24F3F161D93A3FF00827213 /* MSLoggerTests.m */,
380A4DCA1DD6908A00E99219 /* MSApplicationHelperTests.m */,
);
path = MobileCenterTests;
sourceTree = "<group>";
@ -625,6 +640,7 @@
B2C3C1901DB9864600CB83F7 /* MSDevice.h in Headers */,
B2C3C1921DB9864600CB83F7 /* MSWrapperSdk.h in Headers */,
6E04016A1D1C9E1F0051BCFA /* MSMobileCenter.h in Headers */,
38E1B67A1DDE3FDF000EFED1 /* MSMobileCenterPrivate.h in Headers */,
387C75811D6270A300D68CC1 /* MSServiceAbstractInternal.h in Headers */,
B22FC2B61D5E51A20007CD80 /* MSEnvironmentHelper.h in Headers */,
6E0CD69E1D27198A0045FE8C /* MSStorageBucket.h in Headers */,
@ -648,6 +664,7 @@
E8AEE9821D5970A400C0FF6C /* MSLogManagerDelegate.h in Headers */,
6E04016C1D1C9E1F0051BCFA /* MobileCenter.h in Headers */,
E84B8E351D235226006FD231 /* MSHttpSender.h in Headers */,
382EC2071DDBC32B00A60DBD /* MSApplicationHelperPrivate.h in Headers */,
6E171B601D234717000DC480 /* MSLogContainer.h in Headers */,
E88EBBEC1D2C612E007E7785 /* MSAbstractLog.h in Headers */,
6E7E3B781D2DCEBD0019EA6D /* MSFile.h in Headers */,
@ -655,6 +672,7 @@
6E04016F1D1C9E460051BCFA /* MSMobileCenterInternal.h in Headers */,
6E0401701D1C9E460051BCFA /* MSService.h in Headers */,
6E0401711D1C9E460051BCFA /* MSServiceInternal.h in Headers */,
382EC2061DDBC0AC00A60DBD /* MSApplicationHelper.h in Headers */,
E88D170E1D36BB1700A5EA57 /* MSUtils.h in Headers */,
E84B8E321D235209006FD231 /* MSSender.h in Headers */,
E84B8E2E1D2351DB006FD231 /* MSLogManager.h in Headers */,
@ -812,6 +830,7 @@
E88EBBED1D2C612E007E7785 /* MSAbstractLog.m in Sources */,
381C91EA1D3DB65D004512F1 /* MSDeviceTracker.m in Sources */,
38CA60ED1D949F5000B82420 /* MSFileStorage.m in Sources */,
382EC2051DDBC0AC00A60DBD /* MSApplicationHelper.m in Sources */,
6E0684641D36BC8D00A8CC6C /* MSChannelDefault.m in Sources */,
E80EB1081D50273700C9003F /* MSRetriableCall.m in Sources */,
6E0CD69F1D27198A0045FE8C /* MSStorageBucket.m in Sources */,
@ -835,6 +854,7 @@
6EB1F40E1D2443B7005F9F99 /* MSChannelDefaultTests.m in Sources */,
384959D51D491D4F008F6B3A /* MSMobileCenterTest.m in Sources */,
6E5D8A801D25B91F00C033B1 /* MSFileHelperTests.m in Sources */,
380A4DCB1DD6908A00E99219 /* MSApplicationHelperTests.m in Sources */,
E829E4231D25C8BA00F19DA1 /* MSHttpSenderTests.m in Sources */,
6E363AF21D2C84EA0079043D /* MSStorageTestHelper.m in Sources */,
E88EBBFB1D2C8CC7007E7785 /* MSLogContainerTests.m in Sources */,
@ -1001,6 +1021,7 @@
6E2395811D22EF4F00E543C8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
@ -1022,6 +1043,7 @@
6E2395821D22EF4F00E543C8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";

Просмотреть файл

@ -67,10 +67,10 @@ static BOOL needRefresh = YES;
newDevice.sdkVersion = [self sdkVersion:mobilecenter_library_info.ms_version];
newDevice.model = [self deviceModel];
newDevice.oemName = kMSDeviceManufacturer;
newDevice.osName = [self osName:kMSDevice];
newDevice.osVersion = [self osVersion:kMSDevice];
newDevice.osName = [self osName:MS_DEVICE];
newDevice.osVersion = [self osVersion:MS_DEVICE];
newDevice.osBuild = [self osBuild];
newDevice.locale = [self locale:kMSLocale];
newDevice.locale = [self locale:MS_LOCALE];
newDevice.timeZoneOffset = [self timeZoneOffset:[NSTimeZone localTimeZone]];
newDevice.screenSize = [self screenSize];
newDevice.appVersion = [self appVersion:appBundle];

Просмотреть файл

@ -0,0 +1,8 @@
@interface MSMobileCenter ()
/**
* Method to reset the singleton when running unit tests only. So calling sharedInstance returns a fresh instance.
*/
+ (void)resetSharedInstance;
@end

Просмотреть файл

@ -12,7 +12,7 @@
@synthesize logManager = _logManager;
- (instancetype)init {
return [self initWithStorage:kMSUserDefaults];
return [self initWithStorage:MS_USER_DEFAULTS];
}
- (instancetype)initWithStorage:(MSUserDefaults *)storage {
@ -59,7 +59,7 @@
MSLogError([MSMobileCenter getLoggerTag],
@"%@ service hasn't been started. You need to call "
@"[MSMobileCenter start:YOUR_APP_SECRET withServices:LIST_OF_SERVICES] first.",
CLASS_NAME_WITHOUT_PREFIX);
MS_CLASS_NAME_WITHOUT_PREFIX);
}
return canBeUsed;
}
@ -86,7 +86,7 @@
if (![MSMobileCenter isEnabled] && ![MSMobileCenter sharedInstance].enabledStateUpdating) {
MSLogError([MSMobileCenter getLoggerTag], @"The SDK is disabled. Re-enable the whole SDK from MobileCenter "
@"first before enabling %@ service.",
CLASS_NAME_WITHOUT_PREFIX);
MS_CLASS_NAME_WITHOUT_PREFIX);
} else {
[[self sharedInstance] setEnabled:isEnabled];
}

Просмотреть файл

@ -51,7 +51,7 @@ static NSString *const kMSApiPath = @"/logs";
_sendURL = components.URL;
// Hookup to reachability.
[kMSNotificationCenter addObserver:self
[MS_NOTIFICATION_CENTER addObserver:self
selector:@selector(networkStateChanged:)
name:kMSReachabilityChangedNotification
object:nil];

Просмотреть файл

@ -147,7 +147,7 @@ static NSUInteger const MSDefaultLogCountLimit = 50;
- (void)renewCurrentFileForStorageKey:(NSString *)storageKey {
MSStorageBucket *bucket = [self bucketForStorageKey:storageKey];
NSDate *creationDate = [NSDate date];
NSString *fileId = kMSUUIDString;
NSString *fileId = MS_UUID_STRING;
NSString *filePath = [self filePathForStorageKey:storageKey logsId:fileId];
MSFile *file = [[MSFile alloc] initWithPath:filePath fileId:fileId creationDate:creationDate];
bucket.currentFile = file;

Просмотреть файл

@ -0,0 +1,47 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <UIKit/UIKit.h>
/**
* App states
*/
typedef NS_ENUM(NSInteger, MSApplicationState) {
/**
* Application is active.
*/
MSApplicationStateActive = UIApplicationStateActive,
/**
* Application is inactive.
*/
MSApplicationStateInactive = UIApplicationStateInactive,
/**
* Application is in background.
*/
MSApplicationStateBackground = UIApplicationStateBackground,
/**
* Application state can't be determined.
*/
MSApplicationStateUnknown
};
/**
* Utility class to access application APIs.
*/
@interface MSApplicationHelper : NSObject
/**
* Get current application state.
*
* @discussion The application state may not be available anywhere. Application extensions doesn't have it for instance,
* in that case the MSApplicationStateUnknown value is returned.
* @return Current state of the application or MSApplicationStateUnknown while the state can't be determined.
*/
+ (MSApplicationState)applicationState;
@end

Просмотреть файл

@ -0,0 +1,28 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "MSApplicationHelperPrivate.h"
#import "MSUtils.h"
#import <Foundation/Foundation.h>
@implementation MSApplicationHelper
+ (MSApplicationState)applicationState {
// App extentions must not access sharedApplication.
if (!MS_IS_APP_EXTENSION) {
return (MSApplicationState)[[self class] sharedAppState];
}
return MSApplicationStateUnknown;
}
+ (UIApplicationState)sharedAppState {
// Compute selector at runtime for more discretion.
SEL sharedAppSel = NSSelectorFromString(@"sharedApplication");
return [[((UIApplication * (*)(id, SEL))[[UIApplication class] methodForSelector:sharedAppSel])(
[UIApplication class], sharedAppSel) valueForKey:@"applicationState"] longValue];
}
@end

Просмотреть файл

@ -0,0 +1,20 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "MSApplicationHelper.h"
#import <UIKit/UIKit.h>
@interface MSApplicationHelper ()
/**
* Get the shared app state.
*
* @discussion This method is exposed for testing purposes. The shared app state is resolved at runtime by this method
* which makes the UIApplication not mockable. This method is meant to be stubbed in tests to inject the desired
* application states.
* @return The shared app state.
*/
+ (UIApplicationState)sharedAppState;
@end

Просмотреть файл

@ -5,13 +5,12 @@
#ifndef MSUtils_h
#define MSUtils_h
#define mustOverride() NSAssert(NO, @"Method '%@' must be overriden in a subclass", NSStringFromSelector(_cmd))
#define kMSUserDefaults [MSUserDefaults shared]
#define kMSNotificationCenter [NSNotificationCenter defaultCenter]
#define kMSDevice [UIDevice currentDevice]
#define kMSApplication [UIApplication sharedApplication]
#define kMSUUIDString [[NSUUID UUID] UUIDString]
#define kMSUUIDFromString(uuidString) [[NSUUID alloc] initWithUUIDString:uuidString]
#define kMSLocale [NSLocale currentLocale]
#define CLASS_NAME_WITHOUT_PREFIX [NSStringFromClass([self class]) substringFromIndex:2]
#define MS_USER_DEFAULTS [MSUserDefaults shared]
#define MS_NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
#define MS_DEVICE [UIDevice currentDevice]
#define MS_UUID_STRING [[NSUUID UUID] UUIDString]
#define MS_UUID_FROM_STRING(uuidString) [[NSUUID alloc] initWithUUIDString:uuidString]
#define MS_LOCALE [NSLocale currentLocale]
#define MS_CLASS_NAME_WITHOUT_PREFIX [NSStringFromClass([self class]) substringFromIndex:2]
#define MS_IS_APP_EXTENSION [[[NSBundle mainBundle] executablePath] containsString:@".appex/"]
#endif /* MSUtils_h */

Просмотреть файл

@ -116,9 +116,4 @@
*/
+ (BOOL)isDebuggerAttached;
/**
* Method to reset the singleton when running unit tests only. So calling sharedInstance returns a fresh instance.
*/
+ (void)resetSharedInstance;
@end

Просмотреть файл

@ -7,6 +7,7 @@
#import "MSLogManagerDefault.h"
#import "MSLogger.h"
#import "MSMobileCenterInternal.h"
#import "MSMobileCenterPrivate.h"
#import <UIKit/UIKit.h>
#import <sys/sysctl.h>
@ -219,7 +220,7 @@ static NSString *const kMSDefaultBaseUrl = @"https://in.mobile.azure.com";
[self applyPipelineEnabledState:isEnabled];
// Persist the enabled status.
[kMSUserDefaults setObject:[NSNumber numberWithBool:isEnabled] forKey:kMSMobileCenterIsEnabledKey];
[MS_USER_DEFAULTS setObject:[NSNumber numberWithBool:isEnabled] forKey:kMSMobileCenterIsEnabledKey];
}
// Propagate enable/disable on all services.
@ -236,7 +237,7 @@ static NSString *const kMSDefaultBaseUrl = @"https://in.mobile.azure.com";
* Get isEnabled value from persistence.
* No need to cache the value in a property, user settings already have their cache mechanism.
*/
NSNumber *isEnabledNumber = [kMSUserDefaults objectForKey:kMSMobileCenterIsEnabledKey];
NSNumber *isEnabledNumber = [MS_USER_DEFAULTS objectForKey:kMSMobileCenterIsEnabledKey];
// Return the persisted value otherwise it's enabled by default.
return (isEnabledNumber) ? [isEnabledNumber boolValue] : YES;
@ -245,15 +246,15 @@ static NSString *const kMSDefaultBaseUrl = @"https://in.mobile.azure.com";
- (void)applyPipelineEnabledState:(BOOL)isEnabled {
// Remove all notification handlers
[kMSNotificationCenter removeObserver:self];
[MS_NOTIFICATION_CENTER removeObserver:self];
// Hookup to application life-cycle events
if (isEnabled) {
[kMSNotificationCenter addObserver:self
[MS_NOTIFICATION_CENTER addObserver:self
selector:@selector(applicationDidEnterBackground)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[kMSNotificationCenter addObserver:self
[MS_NOTIFICATION_CENTER addObserver:self
selector:@selector(applicationWillEnterForeground)
name:UIApplicationWillEnterForegroundNotification
object:nil];
@ -300,9 +301,9 @@ static NSString *const kMSDefaultBaseUrl = @"https://in.mobile.azure.com";
if (!_installId) {
// Check if install Id has already been persisted.
NSString *savedInstallId = [kMSUserDefaults objectForKey:kMSInstallIdKey];
NSString *savedInstallId = [MS_USER_DEFAULTS objectForKey:kMSInstallIdKey];
if (savedInstallId) {
_installId = kMSUUIDFromString(savedInstallId);
_installId = MS_UUID_FROM_STRING(savedInstallId);
}
// Create a new random install Id if persistency failed.
@ -310,7 +311,7 @@ static NSString *const kMSDefaultBaseUrl = @"https://in.mobile.azure.com";
_installId = [NSUUID UUID];
// Persist the install Id string.
[kMSUserDefaults setObject:[_installId UUIDString] forKey:kMSInstallIdKey];
[MS_USER_DEFAULTS setObject:[_installId UUIDString] forKey:kMSInstallIdKey];
}
}
return _installId;

Просмотреть файл

@ -0,0 +1,95 @@
#import "MSApplicationHelper.h"
#import "MSApplicationHelperPrivate.h"
#import "OCMock.h"
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/OCHamcrestIOS.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface MSApplicationHelperTests : XCTestCase
@property(nonatomic) id appHelper;
@end
@implementation MSApplicationHelperTests
- (void)setUp {
[super setUp];
// Set up application mock.
self.appHelper = OCMClassMock([MSApplicationHelper class]);
}
- (void)tearDown {
[super tearDown];
[self.appHelper stopMocking];
}
- (void)testMSAppStateMatchesUIAppStateWhenAvailable {
// Then
assertThat(@([MSApplicationHelper applicationState]), is(@([UIApplication sharedApplication].applicationState)));
}
- (void)testMSAppReturnsUnknownOnAppExtensions {
/**
* If
*/
// Mock the helper itself to monitor method calls.
id bundleMock = OCMClassMock([NSBundle class]);
OCMStub([bundleMock executablePath]).andReturn(@"/apath/coolappext.appex/coolappext");
OCMStub([bundleMock mainBundle]).andReturn(bundleMock);
/**
* Then
*/
assertThat(@([MSApplicationHelper applicationState]), is(@(MSApplicationStateUnknown)));
// Make sure the sharedApplication as not been called, it's forbidden within app extensions
OCMReject([self.appHelper sharedAppState]);
[bundleMock stopMocking];
}
- (void)testAppActive {
// If
UIApplicationState expectedState = UIApplicationStateActive;
OCMStub([self.appHelper sharedAppState]).andReturn(expectedState);
// When
MSApplicationState state = [MSApplicationHelper applicationState];
// Then
assertThat(@(state), is(@(expectedState)));
}
- (void)testAppInactive {
// If
UIApplicationState expectedState = UIApplicationStateInactive;
OCMStub([self.appHelper sharedAppState]).andReturn(expectedState);
// When
MSApplicationState state = [MSApplicationHelper applicationState];
// Then
assertThat(@(state), is(@(expectedState)));
}
- (void)testAppInBackground {
// If
UIApplicationState expectedState = UIApplicationStateBackground;
OCMStub([self.appHelper sharedAppState]).andReturn(expectedState);
// When
MSApplicationState state = [MSApplicationHelper applicationState];
// Then
assertThat(@(state), is(@(expectedState)));
}
@end

Просмотреть файл

@ -39,7 +39,7 @@ static NSString *const kMSAppSecret = @"mockAppSecret";
NSDictionary *headers = @{
@"Content-Type" : @"application/json",
@"App-Secret" : @"myUnitTestAppSecret",
@"Install-ID" : kMSUUIDString
@"Install-ID" : MS_UUID_STRING
};
NSDictionary *queryStrings = @{ @"api_version" : @"1.0.0-preview20160914" };
@ -291,7 +291,7 @@ static NSString *const kMSAppSecret = @"mockAppSecret";
- (void)testInvalidContainer {
MSMockLog *log1 = [[MSMockLog alloc] init];
log1.sid = kMSUUIDString;
log1.sid = MS_UUID_STRING;
log1.toffset = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]];
// Log does not have device info, therefore, it's an invalid log
@ -466,12 +466,12 @@ static NSString *const kMSAppSecret = @"mockAppSecret";
device.sdkVersion = @"1.0.0";
MSMockLog *log1 = [[MSMockLog alloc] init];
log1.sid = kMSUUIDString;
log1.sid = MS_UUID_STRING;
log1.toffset = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]];
log1.device = device;
MSMockLog *log2 = [[MSMockLog alloc] init];
log2.sid = kMSUUIDString;
log2.sid = MS_UUID_STRING;
log2.toffset = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]];
log2.device = device;

Просмотреть файл

@ -19,11 +19,11 @@
MSLogContainer *logContainer = [[MSLogContainer alloc] init];
MSAbstractLog *log1 = [[MSAbstractLog alloc] init];
log1.sid = kMSUUIDString;
log1.sid = MS_UUID_STRING;
log1.toffset = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]];
MSAbstractLog *log2 = [[MSAbstractLog alloc] init];
log2.sid = kMSUUIDString;
log2.sid = MS_UUID_STRING;
log2.toffset = [NSNumber numberWithInteger:[[NSDate date] timeIntervalSince1970]];
logContainer.logs = (NSArray<MSLog> *)@[ log1, log2 ];

Просмотреть файл

@ -1,7 +1,8 @@
#import <XCTest/XCTest.h>
#import "MSLogger.h"
#import "MSMobileCenter.h"
#import "MSMobileCenterInternal.h"
#import "MSMobileCenterPrivate.h"
#import <XCTest/XCTest.h>
@interface MSLoggerTests : XCTestCase
@ -11,7 +12,7 @@
- (void)setUp {
[super setUp];
[MSLogger setCurrentLogLevel:MSLogLevelAssert];
[MSLogger setIsUserDefinedLogLevel:NO];
}
@ -28,7 +29,7 @@
[MSMobileCenter resetSharedInstance];
[MSMobileCenter sharedInstance].sdkConfigured = NO;
[MSMobileCenter start:[[NSUUID UUID] UUIDString] withServices:nil];
XCTAssertTrue([MSLogger currentLogLevel] == MSLogLevelWarning);
}

Просмотреть файл

@ -1,5 +1,6 @@
#import "MSMobileCenter.h"
#import "MSMobileCenterInternal.h"
#import "MSMobileCenterPrivate.h"
#import "MSUtils.h"
#import <Foundation/Foundation.h>
#import <OCHamcrestIOS/OCHamcrestIOS.h>
@ -58,7 +59,7 @@ static NSString *const kSMNullifiedInstallIdString = @"00000000-0000-0000-0000-0
NSUUID *installId = self.sut.installId;
// Then
assertThat(installId, is(kMSUUIDFromString(kSMInstallIdStringExample)));
assertThat(installId, is(MS_UUID_FROM_STRING(kSMInstallIdStringExample)));
assertThat([installId UUIDString], is(kSMInstallIdStringExample));
}
@ -66,7 +67,7 @@ static NSString *const kSMNullifiedInstallIdString = @"00000000-0000-0000-0000-0
// If
// Unexpected installId is added to the storage.
[[NSUserDefaults standardUserDefaults] setObject:kMSUUIDFromString(@"42") forKey:kMSInstallIdKey];
[[NSUserDefaults standardUserDefaults] setObject:MS_UUID_FROM_STRING(@"42") forKey:kMSInstallIdKey];
// When
NSUUID *installId = self.sut.installId;

Просмотреть файл

@ -3,6 +3,7 @@
#import "MSLogManagerDefault.h"
#import "MSMobileCenter.h"
#import "MSMobileCenterInternal.h"
#import "MSMobileCenterPrivate.h"
#import "MSServiceAbstract.h"
#import "MSServiceAbstractInternal.h"
#import "MSServiceAbstractPrivate.h"
@ -65,7 +66,7 @@
[super setUp];
// Set up the mocked storage.
self.settingsMock = OCMPartialMock(kMSUserDefaults);
self.settingsMock = OCMPartialMock(MS_USER_DEFAULTS);
// System Under Test.
self.abstractService = [[MSServiceAbstractImplementation alloc] initWithStorage:self.settingsMock];

Просмотреть файл

@ -669,6 +669,7 @@
E85547DE1D2D6723002DF6E2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
@ -691,6 +692,7 @@
E85547DF1D2D6723002DF6E2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";

Просмотреть файл

@ -3,6 +3,7 @@
*/
#import "MSAnalyticsInternal.h"
#import "MSApplicationHelper.h"
#import "MSSessionTracker.h"
#import "MSStartSessionLog.h"
@ -18,14 +19,14 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
@property(nonatomic, readwrite) NSString *sessionId;
/**
* Flag to indicate if session tracking has started or not.
* Flag to indicate if session tracking has started or not.
*/
@property(nonatomic) BOOL started;
/**
* Check if current session has timed out.
* Check if current session has timed out.
*
* @return YES if current session has timed out, NO otherwise.
* @return YES if current session has timed out, NO otherwise.
*/
- (BOOL)hasSessionTimedOut;
@ -38,7 +39,7 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
_sessionTimeout = kMSSessionTimeOut;
// Restore past sessions from NSUserDefaults.
NSData *sessions = [kMSUserDefaults objectForKey:kMSPastSessionsKey];
NSData *sessions = [MS_USER_DEFAULTS objectForKey:kMSPastSessionsKey];
if (sessions != nil) {
NSArray *arrayFromData = [NSKeyedUnarchiver unarchiveObjectWithData:sessions];
@ -62,7 +63,7 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
// Check if new session id is required.
if (_sessionId == nil || [self hasSessionTimedOut]) {
_sessionId = kMSUUIDString;
_sessionId = MS_UUID_STRING;
// Record session.
MSSessionHistoryInfo *sessionInfo = [[MSSessionHistoryInfo alloc] init];
@ -77,7 +78,7 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
[self.pastSessions removeLastObject];
// Persist the session history in NSData format.
[kMSUserDefaults setObject:[NSKeyedArchiver archivedDataWithRootObject:self.pastSessions]
[MS_USER_DEFAULTS setObject:[NSKeyedArchiver archivedDataWithRootObject:self.pastSessions]
forKey:kMSPastSessionsKey];
MSLogInfo([MSAnalytics getLoggerTag], @"New session ID: %@", _sessionId);
@ -91,30 +92,31 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
}
- (void)start {
if (!_started) {
if (!self.started) {
// Renew session as needed if app is not in the background.
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
// Request a new session id depending on the application state.
if ([MSApplicationHelper applicationState] == MSApplicationStateInactive ||
[MSApplicationHelper applicationState] == MSApplicationStateActive) {
[self sessionId];
}
// Hookup to application events.
[kMSNotificationCenter addObserver:self
[MS_NOTIFICATION_CENTER addObserver:self
selector:@selector(applicationDidEnterBackground)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[kMSNotificationCenter addObserver:self
[MS_NOTIFICATION_CENTER addObserver:self
selector:@selector(applicationWillEnterForeground)
name:UIApplicationWillEnterForegroundNotification
object:nil];
_started = YES;
self.started = YES;
}
}
- (void)stop {
if (_started) {
[kMSNotificationCenter removeObserver:self];
_started = NO;
if (self.started) {
[MS_NOTIFICATION_CENTER removeObserver:self];
self.started = NO;
}
}
@ -122,7 +124,7 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
@synchronized(self) {
// Clear persistence.
[kMSUserDefaults removeObjectForKey:kMSPastSessionsKey];
[MS_USER_DEFAULTS removeObjectForKey:kMSPastSessionsKey];
// Clear cache.
self.sessionId = nil;
@ -141,6 +143,10 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
BOOL noLogSentForLong =
!self.lastCreatedLogTime || [now timeIntervalSinceDate:self.lastCreatedLogTime] >= self.sessionTimeout;
// FIXME: There is no life cycle for app extensions yet so ignoring the background tests for now.
if (MS_IS_APP_EXTENSION)
return noLogSentForLong;
// Verify if app is currently in the background for a longer time than the session timeout.
BOOL isBackgroundForLong =
(self.lastEnteredBackgroundTime && self.lastEnteredForegroundTime) &&
@ -172,9 +178,6 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
- (void)onProcessingLog:(id<MSLog>)log withPriority:(MSPriority)priority {
// Update time stamp.
_lastCreatedLogTime = [NSDate date];
// Start session log is created in this method, therefore, skip in order to avoid infinite loop.
if ([((NSObject *)log) isKindOfClass:[MSStartSessionLog class]])
return;
@ -194,6 +197,9 @@ static NSUInteger const kMSMaxSessionHistoryCount = 5;
if (log.sid == nil) {
log.sid = self.sessionId;
}
// Update last created log time stamp.
_lastCreatedLogTime = [NSDate date];
}
@end

Просмотреть файл

@ -143,7 +143,7 @@ static NSString *const kMSServiceName = @"Analytics";
// Create and set properties of the event log.
MSEventLog *log = [[MSEventLog alloc] init];
log.name = eventName;
log.eventId = kMSUUIDString;
log.eventId = MS_UUID_STRING;
if (properties)
log.properties = properties;

Просмотреть файл

@ -33,7 +33,7 @@
// If
NSString *typeName = @"event";
NSString *eventId = kMSUUIDString;
NSString *eventId = MS_UUID_STRING;
NSString *eventName = @"eventName";
MSDevice *device = [MSDevice new];
NSString *sessionId = @"1234567890";
@ -69,7 +69,7 @@
// If
NSString *typeName = @"event";
NSString *eventId = kMSUUIDString;
NSString *eventId = MS_UUID_STRING;
NSString *eventName = @"eventName";
MSDevice *device = [MSDevice new];
NSString *sessionId = @"1234567890";

Просмотреть файл

@ -849,6 +849,7 @@
6E171AEA1D22F781000DC480 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
@ -871,6 +872,7 @@
6E171AEB1D22F781000DC480 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";

Просмотреть файл

@ -3,6 +3,7 @@
*/
#import "MSAppleErrorLog.h"
#import "MSApplicationHelper.h"
#import "MSCrashesCXXExceptionWrapperException.h"
#import "MSCrashesDelegate.h"
#import "MSCrashesHelper.h"
@ -103,7 +104,7 @@ static void uncaught_cxx_exception_handler(const MSCrashesUncaughtCXXExceptionIn
} else if (userConfirmation == MSUserConfirmationAlways) {
// Always send logs. Set the flag YES to bypass user confirmation next time.
[kMSUserDefaults setObject:[[NSNumber alloc] initWithBool:YES] forKey:kMSUserConfirmationKey];
[MS_USER_DEFAULTS setObject:[[NSNumber alloc] initWithBool:YES] forKey:kMSUserConfirmationKey];
}
// Process crashes logs.
@ -309,8 +310,10 @@ static void uncaught_cxx_exception_handler(const MSCrashesUncaughtCXXExceptionIn
}
- (void)startCrashProcessing {
if (![MSCrashesHelper isAppExtension] &&
[[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) {
// FIXME: There is no life cycle for app extensions yet so force start crash processing until then.
if ([MSApplicationHelper applicationState] != MSApplicationStateActive &&
[MSApplicationHelper applicationState] != MSApplicationStateUnknown) {
return;
}
@ -388,7 +391,7 @@ static void uncaught_cxx_exception_handler(const MSCrashesUncaughtCXXExceptionIn
// Get a user confirmation if there are crash logs that need to be processed.
if ([_unprocessedLogs count] > 0) {
NSNumber *flag = [kMSUserDefaults objectForKey:kMSUserConfirmationKey];
NSNumber *flag = [MS_USER_DEFAULTS objectForKey:kMSUserConfirmationKey];
if (flag && [flag boolValue]) {
// User confirmation is set to MSUserConfirmationAlways.

Просмотреть файл

@ -8,6 +8,16 @@
/* Begin PBXBuildFile section */
0461BBD11DB68EAD001B4555 /* Main.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0461BBD01DB68EAD001B4555 /* Main.strings */; };
380A4D991DD6892F00E99219 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 380A4D981DD6892F00E99219 /* NotificationCenter.framework */; };
380A4D9D1DD6892F00E99219 /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 380A4D9C1DD6892F00E99219 /* TodayViewController.m */; };
380A4DA01DD6892F00E99219 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 380A4D9E1DD6892F00E99219 /* MainInterface.storyboard */; };
380A4DA41DD6892F00E99219 /* PuppetWidget.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 380A4D961DD6892F00E99219 /* PuppetWidget.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
380A4DC41DD68D1000E99219 /* libMobileCenter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E82E1B881D1CA63000D281C1 /* libMobileCenter.a */; };
380A4DC51DD68D1000E99219 /* libMobileCenterAnalytics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E85548031D2D6C8D002DF6E2 /* libMobileCenterAnalytics.a */; };
380A4DC61DD68D1000E99219 /* libMobileCenterCrashes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E82E1B811D1CA62900D281C1 /* libMobileCenterCrashes.a */; };
380A4DC81DD68D2B00E99219 /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EC99A201D4151A00016C325 /* CrashReporter.framework */; };
380A4DC91DD68D3F00E99219 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EC99A271D4152FA0016C325 /* libc++.tbd */; };
38E1B65A1DDCDDF4000EFED1 /* MSAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 38E1B6591DDCDDF4000EFED1 /* MSAlertController.m */; };
6EC99A211D4151A00016C325 /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EC99A201D4151A00016C325 /* CrashReporter.framework */; };
6EC99A281D4152FA0016C325 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EC99A271D4152FA0016C325 /* libc++.tbd */; };
B21B26C71DDE490400FF0378 /* MSCrashesDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B21B26C61DDE490400FF0378 /* MSCrashesDetailViewController.m */; };
@ -29,6 +39,34 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
380A4DA21DD6892F00E99219 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E82E1B571D1CA58D00D281C1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 380A4D951DD6892F00E99219;
remoteInfo = PuppetWidget;
};
380A4DBE1DD68D0500E99219 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E85547FB1D2D6C8D002DF6E2 /* MobileCenterAnalytics.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = E85547BF1D2D6253002DF6E2;
remoteInfo = MobileCenterAnalytics;
};
380A4DC01DD68D0500E99219 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E82E1B821D1CA63000D281C1 /* MobileCenter.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 6E0401021D1C98220051BCFA;
remoteInfo = MobileCenter;
};
380A4DC21DD68D0500E99219 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E82E1B7C1D1CA62900D281C1 /* MobileCenterCrashes.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 6E0401321D1C98690051BCFA;
remoteInfo = MobileCenterCrashes;
};
E82E1B801D1CA62900D281C1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E82E1B7C1D1CA62900D281C1 /* MobileCenterCrashes.xcodeproj */;
@ -95,7 +133,18 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
B2E612201DDE750A00A9DF86 /* Embed Frameworks */ = {
380A4DB11DD6892F00E99219 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
380A4DA41DD6892F00E99219 /* PuppetWidget.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
B2E612201DDE750A00A9DF86 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
@ -106,12 +155,21 @@
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0461BBD01DB68EAD001B4555 /* Main.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Main.strings; sourceTree = "<group>"; };
380A4D961DD6892F00E99219 /* PuppetWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = PuppetWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
380A4D981DD6892F00E99219 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; };
380A4D9B1DD6892F00E99219 /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = "<group>"; };
380A4D9C1DD6892F00E99219 /* TodayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = "<group>"; };
380A4D9F1DD6892F00E99219 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
380A4DA11DD6892F00E99219 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
384959D81D4972DA008F6B3A /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
6EC99A201D4151A00016C325 /* CrashReporter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CrashReporter.framework; path = ../../Vendor/PLCrashReporter/CrashReporter.framework; sourceTree = "<group>"; };
38E1B6581DDCDDF4000EFED1 /* MSAlertController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSAlertController.h; sourceTree = "<group>"; };
38E1B6591DDCDDF4000EFED1 /* MSAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSAlertController.m; sourceTree = "<group>"; };
6EC99A201D4151A00016C325 /* CrashReporter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CrashReporter.framework; path = ../Vendor/PLCrashReporter/CrashReporter.framework; sourceTree = "<group>"; };
6EC99A251D4152EB0016C325 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
6EC99A271D4152FA0016C325 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
B21B26C51DDE490400FF0378 /* MSCrashesDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSCrashesDetailViewController.h; sourceTree = "<group>"; };
@ -141,6 +199,19 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
380A4D931DD6892F00E99219 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
380A4DC91DD68D3F00E99219 /* libc++.tbd in Frameworks */,
380A4DC81DD68D2B00E99219 /* CrashReporter.framework in Frameworks */,
380A4DC41DD68D1000E99219 /* libMobileCenter.a in Frameworks */,
380A4DC51DD68D1000E99219 /* libMobileCenterAnalytics.a in Frameworks */,
380A4DC61DD68D1000E99219 /* libMobileCenterCrashes.a in Frameworks */,
380A4D991DD6892F00E99219 /* NotificationCenter.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E82E1B5C1D1CA58D00D281C1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -157,32 +228,37 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6EC99A161D4151890016C325 /* Frameworks */ = {
380A4D971DD6892F00E99219 /* Frameworks */ = {
isa = PBXGroup;
children = (
6EC99A201D4151A00016C325 /* CrashReporter.framework */,
380A4D981DD6892F00E99219 /* NotificationCenter.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
B25D927E1DDA75EA0077B73D /* Vendor */ = {
380A4D9A1DD6892F00E99219 /* PuppetWidget */ = {
isa = PBXGroup;
children = (
B25D927F1DDA75F50077B73D /* MSAlertController */,
380A4D9B1DD6892F00E99219 /* TodayViewController.h */,
380A4D9C1DD6892F00E99219 /* TodayViewController.m */,
380A4D9E1DD6892F00E99219 /* MainInterface.storyboard */,
380A4DA11DD6892F00E99219 /* Info.plist */,
);
name = Vendor;
path = PuppetWidget;
sourceTree = "<group>";
};
B25D927F1DDA75F50077B73D /* MSAlertController */ = {
38E1B6571DDCDDF4000EFED1 /* MSAlertController */ = {
isa = PBXGroup;
children = (
B27DCBA31DDA96DA00B97C84 /* MSAlertController.h */,
B27DCBA41DDA96DA00B97C84 /* MSAlertController.m */,
38E1B6581DDCDDF4000EFED1 /* MSAlertController.h */,
38E1B6591DDCDDF4000EFED1 /* MSAlertController.m */,
);
name = MSAlertController;
path = ../../Vendor/MSAlertController;
sourceTree = "<group>";
};
B25DE77E1DD2A9DB00B17EB6 /* Frameworks */ = {
B25DE77E1DD2A9DB00B17EB6 /* Frameworks */ = {
isa = PBXGroup;
children = (
B25DE77F1DD2A9DB00B17EB6 /* CrashLibIOS.framework */,
@ -190,12 +266,22 @@
name = Frameworks;
sourceTree = "<group>";
};
B25D927E1DDA75EA0077B73D /* Vendor */ = {
isa = PBXGroup;
children = (
38E1B6571DDCDDF4000EFED1 /* MSAlertController */,
);
name = Vendor;
sourceTree = "<group>";
};
E82E1B561D1CA58D00D281C1 = {
isa = PBXGroup;
children = (
6EC99A271D4152FA0016C325 /* libc++.tbd */,
6EC99A251D4152EB0016C325 /* libz.tbd */,
E82E1B611D1CA58D00D281C1 /* Puppet */,
380A4D9A1DD6892F00E99219 /* PuppetWidget */,
380A4D971DD6892F00E99219 /* Frameworks */,
E82E1B601D1CA58D00D281C1 /* Products */,
B25DE77E1DD2A9DB00B17EB6 /* Frameworks */,
);
@ -205,6 +291,7 @@
isa = PBXGroup;
children = (
E82E1B5F1D1CA58D00D281C1 /* Puppet.app */,
380A4D961DD6892F00E99219 /* PuppetWidget.appex */,
);
name = Products;
sourceTree = "<group>";
@ -215,7 +302,6 @@
B25D927E1DDA75EA0077B73D /* Vendor */,
E89E6A271D396D6700CAA2CD /* Classes */,
E82E1B7B1D1CA61000D281C1 /* MobileCenter */,
6EC99A161D4151890016C325 /* Frameworks */,
E82E1B621D1CA58D00D281C1 /* Supporting Files */,
);
path = Puppet;
@ -294,6 +380,26 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
380A4D951DD6892F00E99219 /* PuppetWidget */ = {
isa = PBXNativeTarget;
buildConfigurationList = 380A4DB01DD6892F00E99219 /* Build configuration list for PBXNativeTarget "PuppetWidget" */;
buildPhases = (
380A4D921DD6892F00E99219 /* Sources */,
380A4D931DD6892F00E99219 /* Frameworks */,
380A4D941DD6892F00E99219 /* Resources */,
);
buildRules = (
);
dependencies = (
380A4DC11DD68D0500E99219 /* PBXTargetDependency */,
380A4DBF1DD68D0500E99219 /* PBXTargetDependency */,
380A4DC31DD68D0500E99219 /* PBXTargetDependency */,
);
name = PuppetWidget;
productName = PuppetWidget;
productReference = 380A4D961DD6892F00E99219 /* PuppetWidget.appex */;
productType = "com.apple.product-type.app-extension";
};
E82E1B5E1D1CA58D00D281C1 /* Puppet */ = {
isa = PBXNativeTarget;
buildConfigurationList = E82E1B761D1CA58D00D281C1 /* Build configuration list for PBXNativeTarget "Puppet" */;
@ -302,6 +408,7 @@
E82E1B5C1D1CA58D00D281C1 /* Frameworks */,
E82E1B5D1D1CA58D00D281C1 /* Resources */,
B2E612201DDE750A00A9DF86 /* Embed Frameworks */,
380A4DB11DD6892F00E99219 /* Embed App Extensions */,
);
buildRules = (
);
@ -309,6 +416,7 @@
E85548071D2D6C98002DF6E2 /* PBXTargetDependency */,
E82E1B8C1D1CA65600D281C1 /* PBXTargetDependency */,
E82E1B8E1D1CA65600D281C1 /* PBXTargetDependency */,
380A4DA31DD6892F00E99219 /* PBXTargetDependency */,
);
name = Puppet;
productName = Puppet;
@ -325,6 +433,10 @@
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Microsoft Corp.";
TargetAttributes = {
380A4D951DD6892F00E99219 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = L4RARDNZ2Y;
};
E82E1B5E1D1CA58D00D281C1 = {
CreatedOnToolsVersion = 7.3.1;
ProvisioningStyle = Manual;
@ -359,6 +471,7 @@
projectRoot = "";
targets = (
E82E1B5E1D1CA58D00D281C1 /* Puppet */,
380A4D951DD6892F00E99219 /* PuppetWidget */,
);
};
/* End PBXProject section */
@ -409,6 +522,14 @@
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
380A4D941DD6892F00E99219 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
380A4DA01DD6892F00E99219 /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E82E1B5D1D1CA58D00D281C1 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -423,11 +544,19 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
380A4D921DD6892F00E99219 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
380A4D9D1DD6892F00E99219 /* TodayViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
E82E1B5B1D1CA58D00D281C1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B27DCBA51DDA96DA00B97C84 /* MSAlertController.m in Sources */,
38E1B65A1DDCDDF4000EFED1 /* MSAlertController.m in Sources */,
E82E1B671D1CA58D00D281C1 /* AppDelegate.m in Sources */,
E89E6A2D1D396D7900CAA2CD /* MSMainViewController.m in Sources */,
B21B26C71DDE490400FF0378 /* MSCrashesDetailViewController.m in Sources */,
@ -441,6 +570,26 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
380A4DA31DD6892F00E99219 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 380A4D951DD6892F00E99219 /* PuppetWidget */;
targetProxy = 380A4DA21DD6892F00E99219 /* PBXContainerItemProxy */;
};
380A4DBF1DD68D0500E99219 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = MobileCenterAnalytics;
targetProxy = 380A4DBE1DD68D0500E99219 /* PBXContainerItemProxy */;
};
380A4DC11DD68D0500E99219 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = MobileCenter;
targetProxy = 380A4DC01DD68D0500E99219 /* PBXContainerItemProxy */;
};
380A4DC31DD68D0500E99219 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = MobileCenterCrashes;
targetProxy = 380A4DC21DD68D0500E99219 /* PBXContainerItemProxy */;
};
E82E1B8C1D1CA65600D281C1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = MobileCenter;
@ -459,6 +608,14 @@
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
380A4D9E1DD6892F00E99219 /* MainInterface.storyboard */ = {
isa = PBXVariantGroup;
children = (
380A4D9F1DD6892F00E99219 /* Base */,
);
name = MainInterface.storyboard;
sourceTree = "<group>";
};
E82E1B6B1D1CA58D00D281C1 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
@ -478,6 +635,38 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
380A4DA51DD6892F00E99219 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
INFOPLIST_FILE = PuppetWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.azure.mobile.puppet.PuppetWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../MobileCenter/MobileCenter/** $(SRCROOT)/../MobileCenterAnalytics/MobileCenterAnalytics/** $(SRCROOT)/../MobileCenterCrashes/MobileCenterCrashes/**";
};
name = Debug;
};
380A4DA61DD6892F00E99219 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../Vendor\"/**";
INFOPLIST_FILE = PuppetWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.azure.mobile.puppet.PuppetWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../MobileCenter/MobileCenter/** $(SRCROOT)/../MobileCenterAnalytics/MobileCenterAnalytics/** $(SRCROOT)/../MobileCenterCrashes/MobileCenterCrashes/**";
};
name = Release;
};
E82E1B741D1CA58D00D281C1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -628,6 +817,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
380A4DB01DD6892F00E99219 /* Build configuration list for PBXNativeTarget "PuppetWidget" */ = {
isa = XCConfigurationList;
buildConfigurations = (
380A4DA51DD6892F00E99219 /* Debug */,
380A4DA61DD6892F00E99219 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E82E1B5A1D1CA58D00D281C1 /* Build configuration list for PBXProject "Puppet" */ = {
isa = XCConfigurationList;
buildConfigurations = (

Просмотреть файл

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "380A4D951DD6892F00E99219"
BuildableName = "PuppetWidget.appex"
BlueprintName = "PuppetWidget"
ReferencedContainer = "container:Puppet.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82E1B5E1D1CA58D00D281C1"
BuildableName = "Puppet.app"
BlueprintName = "Puppet"
ReferencedContainer = "container:Puppet.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "380A4D951DD6892F00E99219"
BuildableName = "PuppetWidget.appex"
BlueprintName = "PuppetWidget"
ReferencedContainer = "container:Puppet.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82E1B5E1D1CA58D00D281C1"
BuildableName = "Puppet.app"
BlueprintName = "Puppet"
ReferencedContainer = "container:Puppet.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E82E1B5E1D1CA58D00D281C1"
BuildableName = "Puppet.app"
BlueprintName = "Puppet"
ReferencedContainer = "container:Puppet.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -0,0 +1,57 @@
#import <UIKit/UIAlertController.h>
@interface MSAlertAction : UIAlertAction
+ (instancetype)defaultActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
+ (instancetype)cancelActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
+ (instancetype)destructiveActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
@end
/**
* A custom subclass of UIAlertcontroller that can be called from other classes than a UIViewController subclass, e.g.
* from an app's appication delegate.
*/
@interface MSAlertController : UIAlertController
/**
* Initializes a alert controller object.
*
* @param title The title label of the alert controller.
* @param message The message of the alert controller.
* @return instance of MSAlertController.
*/
+ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message;
/**
* Add a default action to the alert controller.
*
* @param title The action's title.
* @param handler A block that will be executed if the user chooses the action.
*/
- (void)addDefaultActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
/**
* Add a cancel action to the alert controller.
*
* @param title The action's title.
* @param handler A block that will be executed if the user chooses the action.
*/
- (void)addCancelActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
/**
* Add a desctructive action to the alert controller.
*
* @param title The action's title.
* @param handler A block that will be executed if the user chosses the action.
*/
- (void)addDestructiveActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
/**
* Show the alert controller to the user.
*/
- (void)show;
@end

Просмотреть файл

@ -0,0 +1,105 @@
#import <UIKit/UIWindow.h>
#import <UIKit/UIScreen.h>
#import "MSAlertController.h"
static char *const MSAlertsDispatchQueue = "com.microsoft.azure.mobilecenter.alertsQueue";
@implementation MSAlertAction
+ (instancetype)defaultActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
return [self actionWithTitle:title style:UIAlertActionStyleDefault handler:handler];
}
+ (instancetype)cancelActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
return [self actionWithTitle:title style:UIAlertActionStyleCancel handler:handler];
}
+ (instancetype)destructiveActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
return [self actionWithTitle:title style:UIAlertActionStyleDestructive handler:handler];
}
@end
@interface MSAlertController ()
@end
@implementation MSAlertController
static UIWindow *window;
static BOOL alertIsBeingPresented;
static NSMutableArray *alertsToBePresented;
static dispatch_queue_t alertsQueue;
+ (void)initialize {
alertIsBeingPresented = NO;
alertsToBePresented = @[].mutableCopy;
alertsQueue = dispatch_queue_create(MSAlertsDispatchQueue, DISPATCH_QUEUE_CONCURRENT);
UIViewController *emptyViewController = [UIViewController new];
[emptyViewController.view setBackgroundColor:[UIColor clearColor]];
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
window.rootViewController = emptyViewController;
window.backgroundColor = [UIColor clearColor];
window.windowLevel = UIWindowLevelAlert + 1;
}
+ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message {
return [self alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
alertIsBeingPresented = NO;
[MSAlertController presentNextPendingAlertController];
}
- (void)addDefaultActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
[self addAction:[MSAlertAction defaultActionWithTitle:title handler:handler]];
}
- (void)addCancelActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
[self addAction:[MSAlertAction cancelActionWithTitle:title handler:handler]];
}
- (void)addDestructiveActionWithTitle:(NSString *)title handler:(void (^)(UIAlertAction *))handler {
[self addAction:[MSAlertAction destructiveActionWithTitle:title handler:handler]];
}
- (void)show {
[self showAnimated:YES];
}
- (void)showAnimated:(BOOL)animated {
dispatch_barrier_async(alertsQueue, ^{
[alertsToBePresented addObject:self];
});
[MSAlertController presentNextPendingAlertController];
}
+ (void)presentNextPendingAlertController {
if (alertIsBeingPresented) {
return;
}
MSAlertController *__block nextAlert;
dispatch_sync(alertsQueue, ^{
nextAlert = alertsToBePresented.firstObject;
});
if (nextAlert) {
alertIsBeingPresented = YES;
dispatch_barrier_async(alertsQueue, ^{
[alertsToBePresented removeObjectAtIndex:0];
});
dispatch_async(dispatch_get_main_queue(), ^{
[window makeKeyAndVisible];
[window.rootViewController presentViewController:nextAlert animated:YES completion:nil];
});
} else {
window.hidden = YES;
alertIsBeingPresented = NO;
}
}
@end

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="M4Y-Lb-cyx">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Today View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ft6-oW-KC0"/>
<viewControllerLayoutGuide type="bottom" id="FKl-LY-JtV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Puppet Widget" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="GcN-lo-r42">
<rect key="frame" x="20" y="8" width="280" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="0.59999999999999998" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qge-BY-5CJ">
<rect key="frame" x="208" y="43" width="41" height="30"/>
<state key="normal" title="Crash"/>
<connections>
<action selector="crashClick:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="7Yc-U3-cOF"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QLI-NU-BiA">
<rect key="frame" x="60" y="43" width="77" height="30"/>
<state key="normal" title="TrackEvent"/>
<connections>
<action selector="trackEventClick:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="1o5-Eh-GE8"/>
</connections>
</button>
</subviews>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="100"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="516" y="285"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -0,0 +1,33 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>PuppetWidget</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widget-extension</string>
</dict>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,9 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import <UIKit/UIKit.h>
@interface TodayViewController : UIViewController
@end

Просмотреть файл

@ -0,0 +1,57 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#import "MSAnalytics.h"
#import "MSCrashes.h"
#import "MSMobileCenter.h"
#import "TodayViewController.h"
#import <NotificationCenter/NotificationCenter.h>
@interface TodayViewController () <NCWidgetProviding>
@end
static BOOL MobileCenterSDKIsSarted = NO;
@implementation TodayViewController
- (void)viewDidLoad {
[super viewDidLoad];
if (!MobileCenterSDKIsSarted) {
[MSMobileCenter setLogLevel:MSLogLevelVerbose];
[MSMobileCenter start:@"7dfb022a-17b5-4d4a-9c75-12bc3ef5e6b7"
withServices:@[ [MSAnalytics class], [MSCrashes class] ]];
MobileCenterSDKIsSarted = YES;
}
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResultFailed
// If there's no update required, use NCUpdateResultNoData
// If there's an update, use NCUpdateResultNewData
completionHandler(NCUpdateResultNewData);
}
- (IBAction)trackEventClick:(id)sender {
[MSAnalytics trackEvent:@"test"];
}
- (IBAction)crashClick:(id)sender {
/* Trigger a crash */
NSArray *array = [NSArray array];
[array objectAtIndex:23];
}
@end

Просмотреть файл

@ -45,7 +45,7 @@ You can either integrate the MobileCenter SDK by adding it's binaries to your Xc
Below are the steps on how to integrate the compiled libraries in your Xcode project to setup the Mobile Center SDK for your iOS app.
1. Download the [Mobile Center SDK](https://aka.ms/ehvc9e) frameworks provided as a zip file.
1. Download the [Mobile Center SDK](https://github.com/Microsoft/MobileCenter-SDK-iOS/releases) frameworks provided as a zip file.
2. Unzip the file and you will see different frameworks for each Mobile Center service. There is a framework called `MobileCenter`, which is required in the project as it contains the logic for persistence, forwarding,... .

Просмотреть файл

@ -20,13 +20,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MSCrashesDelegate {
MSMobileCenter.start("7dfb022a-17b5-4d4a-9c75-12bc3ef5e6b7", withServices: [MSAnalytics.self, MSCrashes.self])
// Analytics-API
// MSAnalytics.trackEvent("Video clicked", withProperties: ["Category" : "Music", "FileName" : "favorite.avi"])
// MSAnalytics.trackEvent("Video clicked")
// MSAnalytics.setEnabled(false)
// var enabled = MSAnalytics.isEnabled()
// Crashes-API
// Crashes Delegate
MSCrashes.setUserConfirmationHandler({ (errorReports: [MSErrorReport]) in
@ -34,18 +27,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MSCrashesDelegate {
// Your code.
// Present your UI to the user, e.g. an UIAlertView.
var alert = MSAlertController(title: "Sorry about that!",
let alert = MSAlertController(title: "Sorry about that!",
message: "Do you want to send an anonymous crash report so we can fix the issue?")
alert?.addDefaultAction(withTitle: "Send", handler: {
alert?.addDefaultAction(withTitle: "Send", handler: { (alert) in
MSCrashes.notify(with: MSUserConfirmation.send)
})
alert?.addDefaultAction(withTitle: "Always Send", handler: {
alert?.addDefaultAction(withTitle: "Always Send", handler: { (alert) in
MSCrashes.notify(with: MSUserConfirmation.always)
})
alert?.addCancelAction(withTitle: "Don't Send", handler: {
alert?.addCancelAction(withTitle: "Don't Send", handler: { (alert) in
MSCrashes.notify(with: MSUserConfirmation.dontSend)
})
alert?.show()
return true
})
@ -87,7 +80,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MSCrashesDelegate {
}
func crashes(_ crashes: MSCrashes!, willSend errorReport: MSErrorReport!) {
}
func crashes(_ crashes: MSCrashes!, didSucceedSending errorReport: MSErrorReport!) {

Просмотреть файл

@ -1,14 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="mKz-fh-1vd">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Navigation Controller-->
<scene sceneID="Ktr-qt-Wij">
<objects>
<navigationController id="mKz-fh-1vd" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="qXR-pQ-kDA">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="97Y-T1-Wlr"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DRG-d4-D6t" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-902" y="54"/>
</scene>
<!--MobileCenter-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="SwiftDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
@ -16,11 +36,51 @@
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="9sU-HQ-Mjc">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="UITableViewCell" textLabel="d3z-ac-QaQ" style="IBUITableViewCellStyleDefault" id="wbw-UY-K0D">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="wbw-UY-K0D" id="FcZ-sS-Nak">
<rect key="frame" x="0.0" y="0.0" width="375" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="d3z-ac-QaQ">
<rect key="frame" x="15" y="0.0" width="345" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="BYZ-38-t0r" id="pW7-E3-iEN"/>
<outlet property="delegate" destination="BYZ-38-t0r" id="nxV-Kd-CSE"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="9sU-HQ-Mjc" secondAttribute="bottom" id="61p-ac-ACJ"/>
<constraint firstAttribute="trailing" secondItem="9sU-HQ-Mjc" secondAttribute="trailing" id="7is-46-mGN"/>
<constraint firstItem="9sU-HQ-Mjc" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="I8e-jh-QEX"/>
<constraint firstItem="9sU-HQ-Mjc" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="v6V-Dt-D3F"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="MobileCenter" id="kcO-bV-iF4"/>
<connections>
<outlet property="tableView" destination="9sU-HQ-Mjc" id="cIV-3V-s7L"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-31" y="54"/>
</scene>
</scenes>
</document>

Просмотреть файл

@ -8,18 +8,111 @@
import UIKit
class ViewController: UIViewController {
import MobileCenter
import MobileCenterAnalytics
import MobileCenterCrashes
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
enum TestCase : String {
case TrackEvent = "Track Event"
case GenerateTestCrash = "Generate Test Crash"
case EnableDisableCrashes = "Enable or disable Crashes"
case EnableDisableAnalytics = "Enable or disable Analytics"
case AppCrashInLastSession = "App crash in the last session?"
static let allCases = [TestCase.TrackEvent, TestCase.GenerateTestCrash, TestCase.EnableDisableCrashes, TestCase.EnableDisableAnalytics, TestCase.AppCrashInLastSession]
}
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self, forCellReuseIdentifier: String(describing: UITableViewCell()))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//MARK: - UITableView DetaSource
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return TestCase.allCases.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: UITableViewCell.self), for: indexPath)
cell.textLabel?.text = TestCase.allCases[indexPath.row].rawValue
return cell;
}
//MARK: - UITableView Delegate
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch TestCase.allCases[indexPath.row] {
//Track Event
case .TrackEvent:
//Track event with name and properties
MSAnalytics.trackEvent("Row Clicked", withProperties: ["Name" : "Track Event", "Row Number" : "\(indexPath.row)"])
//Track event with name only
MSAnalytics.trackEvent("Row Clicked")
self.showAlertWithMessage(title: "MSAnalytics", message: "\(MSAnalytics.isEnabled() ? "Tracking Event!!" : "MSAnalytics Disabled.")")
//Generate Test Crash
case .GenerateTestCrash:
//Test either debugger attached
if MSMobileCenter.isDebuggerAttached(){
self.showAlertWithMessage(title: "", message: "Detecting crashes is NOT enabled due to running the app with a debugger attached.")
}else{
//Generate Crash
MSCrashes.generateTestCrash()
}
case .EnableDisableCrashes:
//Enable/Disable MSCrashes
MSCrashes.setEnabled(!MSCrashes.isEnabled())
self.showAlertWithMessage(title: "MSCrashes", message: "\(MSCrashes.isEnabled() ? "Enabled" : "Disabled")")
case .EnableDisableAnalytics:
//Enable/Disable MSAnalytics
MSAnalytics.setEnabled(!MSAnalytics.isEnabled())
self.showAlertWithMessage(title: "MSAnalytics", message: "\(MSAnalytics.isEnabled() ? "Enabled" : "Disabled")")
case .AppCrashInLastSession:
//Check either app was crashed in last session
let message = "App \(MSCrashes.hasCrashedInLastSession() ? "was" : "wasn't") crashed in last session"
let alert = UIAlertController.init(title: "", message: message, preferredStyle: .alert)
if MSCrashes.hasCrashedInLastSession(){
alert.addAction(UIAlertAction(title: "Show Description", style: .default, handler: { (alert) in
//Get last session crash report
let report = MSCrashes.lastSessionCrashReport()
var message = ""
if let appVersion = report?.device.appVersion{
message.append("App Version - \(appVersion) \n\n")
}
if let appErrorTime = report?.appErrorTime{
message.append("App Error Time - \(appErrorTime) \n\n")
}
if let appStartTime = report?.appStartTime{
message.append("App Start Time - \(appStartTime) \n\n")
}
message.append("MSCrashes.lastSessionCrashReport() will provides you more details about the crash that occurred in the last app session")
self.showAlertWithMessage(title: "Last Session Crash Report", message: message)
}))
}
alert.addAction(UIAlertAction(title: "Okay", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
//MARK: - Helper Methods
private func showAlertWithMessage(title:String, message:String){
let alert = UIAlertController.init(title: title, message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Okay", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}

Просмотреть файл

@ -14,4 +14,6 @@ OTHER_CFLAGS[sdk=iphonesimulator9.*] = $(MOBILE_CENTER_WARNING_FLAGS) -fembed-bi
OTHER_CFLAGS[sdk=iphoneos10.*] = $(MOBILE_CENTER_WARNING_FLAGS) -fembed-bitcode
OTHER_CFLAGS[sdk=iphonesimulator10.*] = $(MOBILE_CENTER_WARNING_FLAGS) -fembed-bitcode-marker
APPLICATION_EXTENSION_API_ONLY = YES;
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS) MOBILE_CENTER_CONFIGURATION_$(CONFIGURATION) MOBILE_CENTER_NAME="@\""$(SDK_NAME)"\"" MOBILE_CENTER_VERSION="@\""$(VERSION_STRING)"\"" MOBILE_CENTER_BUILD="@\""$(BUILD_NUMBER)"\"" MOBILE_CENTER_C_NAME="\""$(SDK_NAME)"\"" MOBILE_CENTER_C_VERSION="\""$(VERSION_STRING)"\"" MOBILE_CENTER_C_BUILD="\""$(BUILD_NUMBER)"\""