This commit is contained in:
unknown 2014-04-01 15:58:45 -07:00
Коммит 42f0fa4535
42 изменённых файлов: 4927 добавлений и 0 удалений

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

@ -0,0 +1,449 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
906E406D16A8851E00817A11 /* Framework */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 906E406E16A8851E00817A11 /* Build configuration list for PBXAggregateTarget "Framework" */;
buildPhases = (
906E407316A8853F00817A11 /* Build other platforms */,
);
dependencies = (
906E407216A8853000817A11 /* PBXTargetDependency */,
);
name = Framework;
productName = Framework;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
8471C92B16EABF5600C73674 /* SBLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 8471C92916EABF5600C73674 /* SBLocalStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
8471C92C16EABF5600C73674 /* SBLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8471C92A16EABF5600C73674 /* SBLocalStorage.m */; };
848CB70A16FBE52D00183E8D /* SBTemplateRegistration.h in Headers */ = {isa = PBXBuildFile; fileRef = 848CB70816FBE52D00183E8D /* SBTemplateRegistration.h */; settings = {ATTRIBUTES = (Private, ); }; };
848CB70B16FBE52D00183E8D /* SBTemplateRegistration.m in Sources */ = {isa = PBXBuildFile; fileRef = 848CB70916FBE52D00183E8D /* SBTemplateRegistration.m */; };
848CB73C16FCC78E00183E8D /* SBStoredRegistrationEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 848CB73A16FCC78E00183E8D /* SBStoredRegistrationEntry.h */; settings = {ATTRIBUTES = (Private, ); }; };
848CB73D16FCC78E00183E8D /* SBStoredRegistrationEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 848CB73B16FCC78E00183E8D /* SBStoredRegistrationEntry.m */; };
906E403C16A86A3200817A11 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 906E403B16A86A3200817A11 /* Foundation.framework */; };
906E406216A86E4300817A11 /* WindowsAzureMessaging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 906E404016A86A3200817A11 /* WindowsAzureMessaging.h */; };
929886F01857FAB100C1676C /* SBStaticHandlerResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 929886EF1857FAB100C1676C /* SBStaticHandlerResponse.h */; };
92988748185931DE00C1676C /* SBStaticHandlerResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 92988747185931DE00C1676C /* SBStaticHandlerResponse.m */; };
A358373916AA3B060041E372 /* SBConnectionString.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371616AA39850041E372 /* SBConnectionString.h */; settings = {ATTRIBUTES = (Public, ); }; };
A358373A16AA3B080041E372 /* SBNotificationHub.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371816AA39850041E372 /* SBNotificationHub.h */; settings = {ATTRIBUTES = (Public, ); }; };
A358373C16AA3B0B0041E372 /* SBRegistration.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371C16AA39850041E372 /* SBRegistration.h */; settings = {ATTRIBUTES = (Private, ); }; };
A358373D16AA3B0D0041E372 /* WindowsAzureMessaging.h in Headers */ = {isa = PBXBuildFile; fileRef = 906E404016A86A3200817A11 /* WindowsAzureMessaging.h */; settings = {ATTRIBUTES = (Public, ); }; };
A358373E16AA3B120041E372 /* SBNotificationHubHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A358370E16AA39850041E372 /* SBNotificationHubHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };
A358373F16AA3B140041E372 /* SBRegistrationParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371016AA39850041E372 /* SBRegistrationParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
A358374016AA3B160041E372 /* SBTokenProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371216AA39850041E372 /* SBTokenProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
A358374116AA3B190041E372 /* SBURLConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A358371416AA39850041E372 /* SBURLConnection.h */; settings = {ATTRIBUTES = (Private, ); }; };
A358374216AA3B1B0041E372 /* SBNotificationHubHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A358370F16AA39850041E372 /* SBNotificationHubHelper.m */; };
A358374316AA3B1D0041E372 /* SBRegistrationParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371116AA39850041E372 /* SBRegistrationParser.m */; };
A358374416AA3B1E0041E372 /* SBTokenProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371316AA39850041E372 /* SBTokenProvider.m */; };
A358374516AA3B1F0041E372 /* SBURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371516AA39850041E372 /* SBURLConnection.m */; };
A358374616AA3B210041E372 /* SBConnectionString.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371716AA39850041E372 /* SBConnectionString.m */; };
A358374716AA3B220041E372 /* SBNotificationHub.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371916AA39850041E372 /* SBNotificationHub.m */; };
A358374916AA3B250041E372 /* SBRegistration.m in Sources */ = {isa = PBXBuildFile; fileRef = A358371D16AA39850041E372 /* SBRegistration.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
906E407116A8853000817A11 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 906E402F16A86A3200817A11 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 906E403716A86A3200817A11;
remoteInfo = WindowsAzureMessaging;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
906E403616A86A3200817A11 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/${PRODUCT_NAME}";
dstSubfolderSpec = 16;
files = (
906E406216A86E4300817A11 /* WindowsAzureMessaging.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
8471C92916EABF5600C73674 /* SBLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBLocalStorage.h; sourceTree = "<group>"; };
8471C92A16EABF5600C73674 /* SBLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBLocalStorage.m; sourceTree = "<group>"; };
848CB70816FBE52D00183E8D /* SBTemplateRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTemplateRegistration.h; path = ../SBTemplateRegistration.h; sourceTree = "<group>"; };
848CB70916FBE52D00183E8D /* SBTemplateRegistration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBTemplateRegistration.m; path = ../SBTemplateRegistration.m; sourceTree = "<group>"; };
848CB73A16FCC78E00183E8D /* SBStoredRegistrationEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBStoredRegistrationEntry.h; sourceTree = "<group>"; };
848CB73B16FCC78E00183E8D /* SBStoredRegistrationEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBStoredRegistrationEntry.m; sourceTree = "<group>"; };
906E403816A86A3200817A11 /* libWindowsAzureMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWindowsAzureMessaging.a; sourceTree = BUILT_PRODUCTS_DIR; };
906E403B16A86A3200817A11 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
906E403F16A86A3200817A11 /* WindowsAzureMessaging-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WindowsAzureMessaging-Prefix.pch"; sourceTree = "<group>"; };
906E404016A86A3200817A11 /* WindowsAzureMessaging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowsAzureMessaging.h; sourceTree = "<group>"; };
929886EF1857FAB100C1676C /* SBStaticHandlerResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBStaticHandlerResponse.h; sourceTree = "<group>"; };
92988747185931DE00C1676C /* SBStaticHandlerResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBStaticHandlerResponse.m; sourceTree = "<group>"; };
A358370E16AA39850041E372 /* SBNotificationHubHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBNotificationHubHelper.h; sourceTree = "<group>"; };
A358370F16AA39850041E372 /* SBNotificationHubHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBNotificationHubHelper.m; sourceTree = "<group>"; };
A358371016AA39850041E372 /* SBRegistrationParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBRegistrationParser.h; sourceTree = "<group>"; };
A358371116AA39850041E372 /* SBRegistrationParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBRegistrationParser.m; sourceTree = "<group>"; };
A358371216AA39850041E372 /* SBTokenProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBTokenProvider.h; sourceTree = "<group>"; };
A358371316AA39850041E372 /* SBTokenProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBTokenProvider.m; sourceTree = "<group>"; };
A358371416AA39850041E372 /* SBURLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBURLConnection.h; sourceTree = "<group>"; };
A358371516AA39850041E372 /* SBURLConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBURLConnection.m; sourceTree = "<group>"; };
A358371616AA39850041E372 /* SBConnectionString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBConnectionString.h; sourceTree = "<group>"; };
A358371716AA39850041E372 /* SBConnectionString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBConnectionString.m; sourceTree = "<group>"; };
A358371816AA39850041E372 /* SBNotificationHub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBNotificationHub.h; sourceTree = "<group>"; };
A358371916AA39850041E372 /* SBNotificationHub.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBNotificationHub.m; sourceTree = "<group>"; };
A358371C16AA39850041E372 /* SBRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBRegistration.h; path = ../SBRegistration.h; sourceTree = "<group>"; };
A358371D16AA39850041E372 /* SBRegistration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBRegistration.m; path = ../SBRegistration.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
906E403516A86A3200817A11 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
906E403C16A86A3200817A11 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
906E402D16A86A3200817A11 = {
isa = PBXGroup;
children = (
906E403D16A86A3200817A11 /* WindowsAzureMessaging */,
906E403A16A86A3200817A11 /* Frameworks */,
906E403916A86A3200817A11 /* Products */,
);
sourceTree = "<group>";
};
906E403916A86A3200817A11 /* Products */ = {
isa = PBXGroup;
children = (
906E403816A86A3200817A11 /* libWindowsAzureMessaging.a */,
);
name = Products;
sourceTree = "<group>";
};
906E403A16A86A3200817A11 /* Frameworks */ = {
isa = PBXGroup;
children = (
906E403B16A86A3200817A11 /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
906E403D16A86A3200817A11 /* WindowsAzureMessaging */ = {
isa = PBXGroup;
children = (
A358370D16AA39850041E372 /* Helpers */,
A358371616AA39850041E372 /* SBConnectionString.h */,
A358371716AA39850041E372 /* SBConnectionString.m */,
A358371816AA39850041E372 /* SBNotificationHub.h */,
A358371916AA39850041E372 /* SBNotificationHub.m */,
906E404016A86A3200817A11 /* WindowsAzureMessaging.h */,
906E403E16A86A3200817A11 /* Supporting Files */,
);
path = WindowsAzureMessaging;
sourceTree = "<group>";
};
906E403E16A86A3200817A11 /* Supporting Files */ = {
isa = PBXGroup;
children = (
906E403F16A86A3200817A11 /* WindowsAzureMessaging-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
A358370D16AA39850041E372 /* Helpers */ = {
isa = PBXGroup;
children = (
92988747185931DE00C1676C /* SBStaticHandlerResponse.m */,
A358370E16AA39850041E372 /* SBNotificationHubHelper.h */,
A358370F16AA39850041E372 /* SBNotificationHubHelper.m */,
A358371016AA39850041E372 /* SBRegistrationParser.h */,
A358371116AA39850041E372 /* SBRegistrationParser.m */,
A358371216AA39850041E372 /* SBTokenProvider.h */,
A358371316AA39850041E372 /* SBTokenProvider.m */,
A358371416AA39850041E372 /* SBURLConnection.h */,
A358371516AA39850041E372 /* SBURLConnection.m */,
8471C92916EABF5600C73674 /* SBLocalStorage.h */,
8471C92A16EABF5600C73674 /* SBLocalStorage.m */,
848CB73A16FCC78E00183E8D /* SBStoredRegistrationEntry.h */,
848CB73B16FCC78E00183E8D /* SBStoredRegistrationEntry.m */,
848CB70816FBE52D00183E8D /* SBTemplateRegistration.h */,
848CB70916FBE52D00183E8D /* SBTemplateRegistration.m */,
A358371C16AA39850041E372 /* SBRegistration.h */,
A358371D16AA39850041E372 /* SBRegistration.m */,
929886EF1857FAB100C1676C /* SBStaticHandlerResponse.h */,
);
path = Helpers;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
906E406416A8710700817A11 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
A358373916AA3B060041E372 /* SBConnectionString.h in Headers */,
A358373A16AA3B080041E372 /* SBNotificationHub.h in Headers */,
A358373D16AA3B0D0041E372 /* WindowsAzureMessaging.h in Headers */,
A358373E16AA3B120041E372 /* SBNotificationHubHelper.h in Headers */,
A358374116AA3B190041E372 /* SBURLConnection.h in Headers */,
848CB70A16FBE52D00183E8D /* SBTemplateRegistration.h in Headers */,
A358373F16AA3B140041E372 /* SBRegistrationParser.h in Headers */,
A358373C16AA3B0B0041E372 /* SBRegistration.h in Headers */,
848CB73C16FCC78E00183E8D /* SBStoredRegistrationEntry.h in Headers */,
8471C92B16EABF5600C73674 /* SBLocalStorage.h in Headers */,
A358374016AA3B160041E372 /* SBTokenProvider.h in Headers */,
929886F01857FAB100C1676C /* SBStaticHandlerResponse.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
906E403716A86A3200817A11 /* WindowsAzureMessaging */ = {
isa = PBXNativeTarget;
buildConfigurationList = 906E404616A86A3200817A11 /* Build configuration list for PBXNativeTarget "WindowsAzureMessaging" */;
buildPhases = (
906E403416A86A3200817A11 /* Sources */,
906E403516A86A3200817A11 /* Frameworks */,
906E403616A86A3200817A11 /* CopyFiles */,
906E406416A8710700817A11 /* Headers */,
906E406016A86CAE00817A11 /* Prepare Framework */,
);
buildRules = (
);
dependencies = (
);
name = WindowsAzureMessaging;
productName = WindowsAzureMessaging;
productReference = 906E403816A86A3200817A11 /* libWindowsAzureMessaging.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
906E402F16A86A3200817A11 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = Microsoft;
};
buildConfigurationList = 906E403216A86A3200817A11 /* Build configuration list for PBXProject "WindowsAzureMessaging" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 906E402D16A86A3200817A11;
productRefGroup = 906E403916A86A3200817A11 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
906E406D16A8851E00817A11 /* Framework */,
906E403716A86A3200817A11 /* WindowsAzureMessaging */,
);
};
/* End PBXProject section */
/* Begin PBXShellScriptBuildPhase section */
906E406016A86CAE00817A11 /* Prepare Framework */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Prepare Framework";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"\n\n# Link the \"Current\" version to \"A\"\n/bin/ln -sfh A \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/Current\"\n/bin/ln -sfh Versions/Current/Headers \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Headers\"\n/bin/ln -sfh \"Versions/Current/${PRODUCT_NAME}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\"\n\n# The -a ensures that the headers maintain the source modification date so that we don't constantly\n# cause propagating rebuilds of files that import these headers.\n/bin/cp -a \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"";
};
906E407316A8853F00817A11 /* Build other platforms */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Build other platforms";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nset +u\n# Avoid recursively calling this script.\nif [[ $SF_MASTER_SCRIPT_RUNNING ]]\nthen\nexit 0\nfi\nset -u\nexport SF_MASTER_SCRIPT_RUNNING=1\n\nSF_TARGET_NAME=${PROJECT_NAME}\nSF_EXECUTABLE_PATH=\"lib${SF_TARGET_NAME}.a\"\nSF_WRAPPER_NAME=\"${SF_TARGET_NAME}.framework\"\n\n# The following conditionals come from\n# https://github.com/kstenerud/iOS-Universal-Framework\n\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]\nthen\nSF_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]\nthen\nSF_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SF_SDK_PLATFORM\" = \"iphoneos\" ]]\nthen\nSF_OTHER_PLATFORM=iphonesimulator\nelse\nSF_OTHER_PLATFORM=iphoneos\nfi\n\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$SF_SDK_PLATFORM$ ]]\nthen\nSF_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${SF_OTHER_PLATFORM}\"\nelse\necho \"Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR\"\nexit 1\nfi\n\n# Build the other platform.\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" OBJROOT=\"${OBJROOT}\" BUILD_ROOT=\"${BUILD_ROOT}\" SYMROOT=\"${SYMROOT}\" $ACTION\n\n# Smash the two static libraries into one fat binary and store it in the .framework\nlipo -create \"${BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" -output \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\"\n\n# Copy the binary to the other architecture folder to have a complete framework in both.\ncp -a \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/A/${SF_TARGET_NAME}\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
906E403416A86A3200817A11 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A358374216AA3B1B0041E372 /* SBNotificationHubHelper.m in Sources */,
A358374316AA3B1D0041E372 /* SBRegistrationParser.m in Sources */,
A358374516AA3B1F0041E372 /* SBURLConnection.m in Sources */,
A358374716AA3B220041E372 /* SBNotificationHub.m in Sources */,
A358374916AA3B250041E372 /* SBRegistration.m in Sources */,
A358374616AA3B210041E372 /* SBConnectionString.m in Sources */,
A358374416AA3B1E0041E372 /* SBTokenProvider.m in Sources */,
8471C92C16EABF5600C73674 /* SBLocalStorage.m in Sources */,
848CB73D16FCC78E00183E8D /* SBStoredRegistrationEntry.m in Sources */,
848CB70B16FBE52D00183E8D /* SBTemplateRegistration.m in Sources */,
92988748185931DE00C1676C /* SBStaticHandlerResponse.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
906E407216A8853000817A11 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 906E403716A86A3200817A11 /* WindowsAzureMessaging */;
targetProxy = 906E407116A8853000817A11 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
906E404416A86A3200817A11 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
};
name = Debug;
};
906E404516A86A3200817A11 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
906E404716A86A3200817A11 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = /tmp/WindowsAzureMessaging.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessaging/WindowsAzureMessaging-Prefix.pch";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)Headers";
SKIP_INSTALL = YES;
};
name = Debug;
};
906E404816A86A3200817A11 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = /tmp/WindowsAzureMessaging.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessaging/WindowsAzureMessaging-Prefix.pch";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "$(PROJECT_NAME)Headers";
SKIP_INSTALL = YES;
};
name = Release;
};
906E406F16A8851E00817A11 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
906E407016A8851E00817A11 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
906E403216A86A3200817A11 /* Build configuration list for PBXProject "WindowsAzureMessaging" */ = {
isa = XCConfigurationList;
buildConfigurations = (
906E404416A86A3200817A11 /* Debug */,
906E404516A86A3200817A11 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
906E404616A86A3200817A11 /* Build configuration list for PBXNativeTarget "WindowsAzureMessaging" */ = {
isa = XCConfigurationList;
buildConfigurations = (
906E404716A86A3200817A11 /* Debug */,
906E404816A86A3200817A11 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
906E406E16A8851E00817A11 /* Build configuration list for PBXAggregateTarget "Framework" */ = {
isa = XCConfigurationList;
buildConfigurations = (
906E406F16A8851E00817A11 /* Debug */,
906E407016A8851E00817A11 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 906E402F16A86A3200817A11 /* Project object */;
}

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

@ -0,0 +1,36 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBStoredRegistrationEntry.h"
#import "SBRegistration.h"
@interface SBLocalStorage : NSObject
{
@private
NSString* _path;
NSMutableDictionary* _registrations;
NSString* _versionKey;
NSString* _deviceTokenKey;
NSString* _registrationsKey;
}
@property (copy, nonatomic) NSString* deviceToken;
@property (nonatomic) BOOL isRefreshNeeded;
- (SBLocalStorage*) initWithNotificationHubPath: (NSString*) notificationHubPath;
- (void) refreshFinishedWithDeviceToken:(NSString*)newDeviceToken;
- (StoredRegistrationEntry*) getStoredRegistrationEntryWithRegistrationName:(NSString*) registrationName;
- (void) updateWithRegistrationName: (NSString*) registrationName registration:(SBRegistration*) registration;
- (void) updateWithRegistrationName: (NSString*) registrationName registrationId:(NSString*) registrationId eTag:(NSString*) eTag deviceToken:(NSString*) devToken;
- (void) updateWithRegistration: (SBRegistration*) registration;
- (void) deleteWithRegistrationName: (NSString*) registrationName;
- (void) deleteAllRegistrations;
@end

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

@ -0,0 +1,184 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBLocalStorage.h"
#import "SBNotificationHub.h"
#import "SBNotificationHubHelper.h"
#import "SBRegistration.h"
#import "SBTemplateRegistration.h"
@implementation SBLocalStorage
@synthesize isRefreshNeeded, deviceToken;
NSString* const storageVersion = @"v1.0.0";
- (SBLocalStorage*) initWithNotificationHubPath: (NSString*) notificationHubPath
{
self = [super init];
if( self){
self->_path = notificationHubPath;
self->_versionKey = [NSString stringWithFormat:@"%@-version", notificationHubPath];
self->_deviceTokenKey = [NSString stringWithFormat:@"%@-deviceToken", notificationHubPath];
self->_registrationsKey =[NSString stringWithFormat:@"%@-registrations", notificationHubPath];
[self readContent];
}
return self;
}
- (StoredRegistrationEntry*) getStoredRegistrationEntryWithRegistrationName:(NSString*) registrationName
{
StoredRegistrationEntry* reg = [self->_registrations objectForKey:registrationName];
return reg;
}
- (void) updateWithRegistration: (SBRegistration*) registration
{
for (NSString* key in [self->_registrations allKeys])
{
StoredRegistrationEntry* reg = [self->_registrations objectForKey:key];
if( [reg.RegistrationId isEqualToString: registration.registrationId])
{
[self updateWithRegistrationName:key registration:registration];
return;
}
}
// If this is not in the cache then it probably is wiped out from client (due to reinstall)
if( [registration class] == [SBTemplateRegistration class])
{
if (((SBTemplateRegistration*)registration).templateName != nil)
{
// In this specific case we just use the template name that is sent from server to recreate the config.
[self updateWithRegistrationName:((SBTemplateRegistration*)registration).templateName registration:registration];
}
else
{
// This is a server created registration
[self updateWithRegistrationName:registration.registrationId registration:registration];
}
}
else
{
// This is most likely SDK created registration. But if the server creates a default registration then we are in merky waters here
[self updateWithRegistrationName:SBRegistration.Name registration:registration];
}
}
- (void) updateWithRegistrationName: (NSString*) registrationName registration:(SBRegistration*) registration
{
if( registration == nil)
{
[self deleteWithRegistrationName:registrationName];
return;
}
StoredRegistrationEntry* reg = [[StoredRegistrationEntry alloc] init];
reg.RegistrationName = [SBNotificationHubHelper nameOfRegistration:registration];
reg.registrationId = registration.registrationId;
reg.ETag = registration.ETag;
[self->_registrations setValue:reg forKey:reg.RegistrationName];
self->deviceToken = [registration deviceToken];
[self flush];
}
- (void) updateWithRegistrationName:(NSString*) registrationName registrationId:(NSString*) registrationId eTag:(NSString*) eTag deviceToken:(NSString*) devToken
{
StoredRegistrationEntry* reg = [[StoredRegistrationEntry alloc] init];
reg.RegistrationName = registrationName;
reg.registrationId = registrationId;
reg.ETag = eTag;
[self->_registrations setValue:reg forKey:reg.RegistrationName];
self->deviceToken = devToken;
[self flush];
}
- (void) deleteWithRegistrationName: (NSString*) registrationName
{
[self->_registrations removeObjectForKey:registrationName];
[self flush];
}
- (void) deleteAllRegistrations
{
[self->_registrations removeAllObjects];
[self flush];
}
- (void) readContent
{
self->_registrations = [[NSMutableDictionary alloc] init];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self->deviceToken = [defaults objectForKey:self->_deviceTokenKey];
NSString* version = [defaults objectForKey:self->_versionKey];
isRefreshNeeded = version == nil || ![version isEqualToString: storageVersion];
if( isRefreshNeeded )
{
return;
}
NSArray* registrations = [defaults objectForKey:self->_registrationsKey];
for (NSString* regStr in registrations)
{
StoredRegistrationEntry* reg = [[StoredRegistrationEntry alloc] initWithString:regStr];
[self->_registrations setValue:reg forKey:reg.RegistrationName];
}
}
- (void) flush
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:self->deviceToken forKey:self->_deviceTokenKey];
[defaults setObject:storageVersion forKey:self->_versionKey];
NSMutableArray* registrations = [[NSMutableArray alloc] init];
for (NSString* key in [self->_registrations allKeys])
{
StoredRegistrationEntry* reg = [self->_registrations objectForKey:key];
[registrations addObject: [reg toString]];
}
if( [registrations count] == 0)
{
[defaults removeObjectForKey:self->_registrationsKey];
}
else
{
[defaults setObject:registrations forKey:self->_registrationsKey];
}
[defaults synchronize];
}
- (void) refreshFinishedWithDeviceToken:(NSString*)newDeviceToken
{
isRefreshNeeded = FALSE;
if( ![self->deviceToken isEqualToString:newDeviceToken])
{
self->deviceToken = newDeviceToken;
[self flush];
}
}
@end

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

@ -0,0 +1,41 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBRegistration.h"
@interface SBNotificationHubHelper : NSObject
+ (NSString*) urlEncode: (NSString*)urlString;
+ (NSString*) urlDecode: (NSString*)urlString;
+ (NSString*) createHashWithData:(NSData*)data;
+ (NSString*) signString: (NSString*)str withKey:(NSString*) key;
+ (NSString*) signString: (NSString*)str withKeyData:(const char*) cKey keyLength:(NSInteger) keyLength;
+ (NSData*) fromBase64: (NSString*) str;
+ (NSString*) toBase64: (unsigned char*) data length:(NSInteger) length;
+ (NSString*) convertTagSetToString:(NSSet*)tagSet;
+ (NSError*) errorWithMsg:(NSString*)msg code:(NSInteger)code;
+ (NSError*) errorForNullDeviceToken;
+ (NSError*) errorForReservedTemplateName;
+ (NSError*) errorForInvalidTemplateName;
+ (NSError*) registrationNotFoundError;
+ (NSDictionary*) parseConnectionString:(NSString*) connectionString;
+ (NSURL*) modifyEndpoint:(NSURL*)endPoint scheme:(NSString*)scheme;
+ (NSString*) nameOfRegistration:(SBRegistration*)registration;
@end

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

@ -0,0 +1,277 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBNotificationHubHelper.h"
#import "SBTemplateRegistration.h"
#import <CommonCrypto/CommonHMAC.h>
#import <CommonCrypto/CommonDigest.h>
@implementation SBNotificationHubHelper
static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static char decodingTable[128];
static NSString* decodingTableLock = @"decodingTableLock";
+ (NSString*) urlEncode: (NSString*)urlString{
return (__bridge NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)urlString, NULL,CFSTR("!*'();:@&=+$,/?%#[]"), kCFStringEncodingUTF8);
}
+ (NSString*) urlDecode: (NSString*)urlString{
return [[urlString
stringByReplacingOccurrencesOfString:@"+" withString:@" "]
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}
+ (NSString*) createHashWithData:(NSData*)data{
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(data.bytes, (CC_LONG)data.length, digest);
NSString* hash = [self toBase64:(unsigned char *)digest length:CC_SHA1_DIGEST_LENGTH];
return [[[hash stringByReplacingOccurrencesOfString:@"=" withString:@""] stringByReplacingOccurrencesOfString:@"+" withString:@"-"] stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
}
+ (NSString*) signString: (NSString*)str withKeyData:(const char*) cKey keyLength:(NSInteger) keyLength{
const char *cData = [str cStringUsingEncoding:NSUTF8StringEncoding];
unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH];
CCHmac(kCCHmacAlgSHA256, cKey, keyLength, cData, strlen(cData), cHMAC);
NSData *HMAC = [[NSData alloc] initWithBytes:cHMAC length:CC_SHA256_DIGEST_LENGTH];
NSString* signature = [self toBase64:(unsigned char *)[HMAC bytes] length:[HMAC length]];
return signature;
}
+ (NSString*) signString: (NSString*)str withKey:(NSString*) key{
const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding];
return [self signString:str withKeyData:cKey keyLength:strlen(cKey)];
}
+ (NSData*) fromBase64: (NSString*) str{
if(decodingTable['B'] != 1)
{
@synchronized(decodingTableLock)
{
if(decodingTable['B'] != 1)
{
memset(decodingTable, 0, 128);
int length = (sizeof encodingTable);
for (int i = 0; i < length; i++)
{
decodingTable[encodingTable[i]] = i;
}
}
}
}
NSData* inputData = [str dataUsingEncoding:NSASCIIStringEncoding];
const char* input =inputData.bytes;
NSInteger inputLength = inputData.length;
if ((input == NULL) || (inputLength% 4 != 0)) {
return nil;
}
while (inputLength > 0 && input[inputLength - 1] == '=') {
inputLength--;
}
int outputLength = inputLength * 3 / 4;
NSMutableData* outputData = [NSMutableData dataWithLength:outputLength];
uint8_t* output = outputData.mutableBytes;
int outputPos = 0;
for (int i=0; i<inputLength; i += 4)
{
char i0 = input[i];
char i1 = input[i+1];
char i2 = i+2 < inputLength ? input[i+2] : 'A';
char i3 = i+3 < inputLength ? input[i+3] : 'A';
char result =(decodingTable[i0] << 2) | (decodingTable[i1] >> 4);
output[outputPos++] = result;
if (outputPos < outputLength) {
output[outputPos++] = ((decodingTable[i1] & 0xf) << 4) | (decodingTable[i2] >> 2);
}
if (outputPos < outputLength) {
output[outputPos++] = ((decodingTable[i2] & 0x3) << 6) | decodingTable[i3];
}
}
return outputData;
}
+ (NSString*) toBase64: (unsigned char*) data length:(NSInteger) length{
NSMutableString *dest = [[NSMutableString alloc] initWithString:@""];
unsigned char * tempData = (unsigned char *)data;
NSInteger srcLen = length;
for (int i=0; i<srcLen; i += 3)
{
NSInteger value = 0;
for (int j = i; j < (i + 3); j++) {
value <<= 8;
if (j < length) {
value |= (0xFF & tempData[j]);
}
}
[dest appendFormat:@"%c", encodingTable[(value >> 18) & 0x3F]];
[dest appendFormat:@"%c", encodingTable[(value >> 12) & 0x3F]];
[dest appendFormat:@"%c", (i + 1) < length ? encodingTable[(value >> 6) & 0x3F] : '='];
[dest appendFormat:@"%c", (i + 2) < length ? encodingTable[(value >> 0) & 0x3F] : '='];
}
return dest;
}
+ (NSString*) convertTagSetToString:(NSSet*)tagSet
{
if(!tagSet)
{
return @"";
}
NSMutableString* tags;
for (NSString *element in tagSet) {
if(!tags)
{
tags=[[NSMutableString alloc] initWithString:element];
}
else
{
[tags appendString:[NSString stringWithFormat:@",%@",element]];
}
}
return tags;
}
NSString* const domain = @"WindowsAzureMessaging";
+ (NSError*) errorForNullDeviceToken
{
return [SBNotificationHubHelper errorWithMsg:@"Device Token is not updated. Please call refreshRegistrationsWithDeviceToken." code:-1];
}
+ (NSError*) errorForReservedTemplateName
{
return [SBNotificationHubHelper errorWithMsg:@"TemplateName is conflict with reservered ones." code:-1];
}
+ (NSError*) errorForInvalidTemplateName
{
return [SBNotificationHubHelper errorWithMsg:@"TemplateName can't contains ':'." code:-1];
}
+ (NSError*) errorWithMsg:(NSString*)msg code:(NSInteger)code
{
NSMutableDictionary* details = [NSMutableDictionary dictionary];
[details setValue:msg forKey:NSLocalizedDescriptionKey];
return [[NSError alloc] initWithDomain:domain code:code userInfo:details];
}
+ (NSError*) registrationNotFoundError
{
NSMutableDictionary* details = [NSMutableDictionary dictionary];
[details setValue:@"Registration is not found." forKey:NSLocalizedDescriptionKey];
return [[NSError alloc] initWithDomain:domain code:404 userInfo:details];
}
+ (NSDictionary*) parseConnectionString:(NSString*) connectionString
{
NSArray *allField = [connectionString componentsSeparatedByString:@";"];
NSMutableDictionary* result = [NSMutableDictionary dictionary];
NSString* previousLeft = @"";
for (int i=0; i< [allField count]; i++) {
NSString* currentField = (NSString*)[allField objectAtIndex:i];
if( (i+1) < [allField count])
{
// if next field does not start with known name, this ';' will be ignored
NSString* lowerCaseNextField = [(NSString*)[allField objectAtIndex:(i+1)] lowercaseString];
if(!([lowerCaseNextField hasPrefix:@"endpoint="] ||
[lowerCaseNextField hasPrefix:@"sharedaccesskeyname="] ||
[lowerCaseNextField hasPrefix:@"sharedaccesskey="] ||
[lowerCaseNextField hasPrefix:@"sharedsecretissuer="] ||
[lowerCaseNextField hasPrefix:@"sharedsecretvalue="] ||
[lowerCaseNextField hasPrefix:@"stsendpoint="] ))
{
previousLeft = [NSString stringWithFormat:@"%@%@;",previousLeft,currentField];
continue;
}
}
currentField = [NSString stringWithFormat:@"%@%@",previousLeft,currentField];
previousLeft = @"";
NSArray *keyValuePairs = [currentField componentsSeparatedByString:@"="];
if([keyValuePairs count] < 2)
{
break;
}
NSString* keyName = [[keyValuePairs objectAtIndex: 0] lowercaseString];
NSString* keyValue =[currentField substringFromIndex:([keyName length] +1)];
if([keyName isEqualToString:@"endpoint"]){
{
keyValue = [[SBNotificationHubHelper modifyEndpoint:[NSURL URLWithString:keyValue] scheme:@"https"] absoluteString];
}
}
[result setObject:keyValue forKey:keyName];
}
return result;
}
// add last slash, and change to desinged scheme
+ (NSURL*) modifyEndpoint:(NSURL*)endPoint scheme:(NSString*)scheme
{
NSString* modifiedEndpoint = [NSString stringWithString:[endPoint absoluteString]];
if(![modifiedEndpoint hasSuffix:@"/"])
{
modifiedEndpoint = [NSString stringWithFormat:@"%@/",modifiedEndpoint];
}
NSInteger position = [modifiedEndpoint rangeOfString:@":"].location;
if( position == NSNotFound)
{
modifiedEndpoint = [scheme stringByAppendingFormat:@"://%@",modifiedEndpoint];
}
else
{
modifiedEndpoint = [scheme stringByAppendingFormat:@"%@",[modifiedEndpoint substringFromIndex:position]];
}
return [NSURL URLWithString:modifiedEndpoint];
}
+ (NSString*) nameOfRegistration:(SBRegistration*)registration
{
if( [registration class] == [SBTemplateRegistration class])
{
return ((SBTemplateRegistration*)registration).templateName;
}
else
{
return [SBRegistration Name];
}
}
@end

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

@ -0,0 +1,17 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistration.h"
@interface SBRegistrationParser : NSObject{
@private
NSMutableArray *_allRegistrations;
NSMutableString *_currentElementValue;
SBRegistration *_currentRegistration;
}
- (SBRegistrationParser*) initParserWithResult:(NSMutableArray*)result;
+ (NSArray *)parseRegistrations:(NSData *)data error:(NSError **)error;
@end

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

@ -0,0 +1,124 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistrationParser.h"
#import "SBTemplateRegistration.h"
#import "SBNotificationHubHelper.h"
@implementation SBRegistrationParser
- (SBRegistrationParser*) initParserWithResult:(NSMutableArray*)result
{
self = [super init];
_allRegistrations = result;
return self;
}
+ (NSArray *)parseRegistrations:(NSData *)data error:(NSError **)error
{
NSMutableArray* registrations = [[NSMutableArray alloc]init];
NSXMLParser* xmlParser = [[NSXMLParser alloc] initWithData:data];
SBRegistrationParser* registrationDelegates = [[SBRegistrationParser alloc] initParserWithResult:registrations];
[xmlParser setDelegate:(id)registrationDelegates];
if(![xmlParser parse])
{
if(error)
{
NSString* msg = [NSString stringWithFormat:@"Fail to parse registration:%@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]];
//NSLog(@"%@",msg);
(*error)=[SBNotificationHubHelper errorWithMsg:msg code:-1];
}
}
return registrations;
}
- (void) parser: (NSXMLParser*)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if([elementName isEqualToString:@"AppleRegistrationDescription"])
{
_currentRegistration = [[SBRegistration alloc] init];
return;
}
if([elementName isEqualToString:@"AppleTemplateRegistrationDescription"])
{
_currentRegistration = [[SBTemplateRegistration alloc] init];
return;
}
}
- (void) parser:(NSXMLParser*)parser foundCharacters:(NSString *)string
{
if(!_currentElementValue)
{
_currentElementValue = [[NSMutableString alloc] initWithString:string];
}
else
{
[_currentElementValue appendString:string];
}
}
- (void) parser :(NSXMLParser*)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if([elementName isEqualToString:@"feed"])
{
return;
}
if([elementName isEqualToString:@"AppleRegistrationDescription"] ||
[elementName isEqualToString:@"AppleTemplateRegistrationDescription"])
{
[_allRegistrations addObject:_currentRegistration];
_currentRegistration = nil;
return;
}
if( [elementName isEqualToString:@"ExpirationTime"])
{
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSS'Z'"];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
_currentRegistration.expiresAt = [formatter dateFromString:_currentElementValue];
}
else if([elementName isEqualToString:@"RegistrationId"])
{
_currentRegistration.registrationId = _currentElementValue;
}
else if([elementName isEqualToString:@"ETag"])
{
_currentRegistration.ETag = _currentElementValue;
}
else if([elementName isEqualToString:@"DeviceToken"])
{
_currentRegistration.deviceToken = _currentElementValue;
}
else if( [elementName isEqualToString:@"Tags"])
{
NSArray *allTags = [_currentElementValue componentsSeparatedByString:@","];
_currentRegistration.tags = [[NSSet alloc] initWithArray:allTags];
}
else if( [elementName isEqualToString:@"Expiry"])
{
((SBTemplateRegistration*)_currentRegistration).expiry = _currentElementValue;
}
else if( [elementName isEqualToString:@"BodyTemplate"])
{
((SBTemplateRegistration*)_currentRegistration).bodyTemplate = _currentElementValue;
}
else if( [elementName isEqualToString:@"TemplateName"])
{
((SBTemplateRegistration*)_currentRegistration).templateName = _currentElementValue;
}
_currentElementValue=nil;
}
@end

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

@ -0,0 +1,11 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBStaticHandlerResponse : NSObject
@property (copy, nonatomic) NSData* Data;
@property (copy, nonatomic) NSDictionary *Headers;
@end

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

@ -0,0 +1,11 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStaticHandlerResponse.h"
@implementation SBStaticHandlerResponse
@synthesize Data, Headers;
@end

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

@ -0,0 +1,16 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface StoredRegistrationEntry : NSObject
@property (copy, nonatomic) NSString* RegistrationName;
@property (copy, nonatomic) NSString* RegistrationId;
@property (copy, nonatomic) NSString* ETag;
- (StoredRegistrationEntry*) initWithString:(NSString*) string;
- (NSString*) toString;
@end

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

@ -0,0 +1,38 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBStoredRegistrationEntry.h"
@implementation StoredRegistrationEntry
@synthesize RegistrationName, RegistrationId, ETag;
- (StoredRegistrationEntry*) initWithString:(NSString*)string
{
self = [super init];
if(string == nil)
{
return nil;
}
if( self){
NSArray *entries = [string componentsSeparatedByString:@":"];
if( [entries count] == 3)
{
self->RegistrationName = [entries objectAtIndex:0];
self->RegistrationId = [entries objectAtIndex:1];
self->ETag = [entries objectAtIndex:2];
}
}
return self;
}
- (NSString*) toString
{
return [NSString stringWithFormat:@"%@:%@:%@",self->RegistrationName,self->RegistrationId, self->ETag];
}
@end

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

@ -0,0 +1,24 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
@interface SBTokenProvider : NSObject{
@private
NSString* _sharedAccessKey;
NSString* _sharedAccessKeyName ;
NSString* _sharedSecret;
NSString* _sharedSecretIssurer;
NSURL* _stsHostName;
NSURL* _serviceEndPoint;
}
@property (nonatomic) NSInteger timeToExpireinMins;
- (SBTokenProvider*) initWithConnectionDictinary: (NSDictionary*) connectionDictionary;
- (void) setTokenWithRequest:(NSMutableURLRequest*)request completion:(void (^)(NSError*))completion;
- (BOOL) setTokenWithRequest:(NSMutableURLRequest*)request error:(NSError**)error;
@end

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

@ -0,0 +1,303 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBTokenProvider.h"
#import "SBNotificationHubHelper.h"
#import "SBURLConnection.h"
@implementation SBTokenProvider
const int defaultTimeToExpireinMins = 20;
@synthesize timeToExpireinMins;
- (SBTokenProvider*) initWithConnectionDictinary: (NSDictionary*) connectionDictionary
{
self = [super init];
if( self){
if(![self initMembersWithDictionary:connectionDictionary])
{
return nil;
}
}
return self;
}
- (BOOL)initMembersWithDictionary:(NSDictionary*) connectionDictionary
{
self->timeToExpireinMins = defaultTimeToExpireinMins;
NSString* endpoint = [connectionDictionary objectForKey:@"endpoint"];
if( endpoint)
{
self->_serviceEndPoint = [[NSURL alloc] initWithString:endpoint];
}
NSString* stsendpoint = [connectionDictionary objectForKey:@"stsendpoint"];
if( stsendpoint)
{
self->_stsHostName = [[NSURL alloc] initWithString:stsendpoint];
}
self->_sharedAccessKey = [connectionDictionary objectForKey:@"sharedaccesskey"];
self->_sharedAccessKeyName = [connectionDictionary objectForKey:@"sharedaccesskeyname"];
self->_sharedSecret = [connectionDictionary objectForKey:@"sharedsecretvalue"];
self->_sharedSecretIssurer = [connectionDictionary objectForKey:@"sharedsecretissuer"];
// validation
if(self->_serviceEndPoint == nil ||
[self->_serviceEndPoint host] == nil)
{
NSLog(@"%@",@"Endpoint is missing or not in URL format in connectionString.");
return FALSE;
}
if((self->_sharedAccessKey == nil || self->_sharedAccessKeyName == nil) &&
self->_sharedSecret == nil)
{
NSLog(@"%@",@"Security information is missing in connectionString.");
return FALSE;
}
if(self->_stsHostName == nil)
{
NSString* nameSpace = [[[self->_serviceEndPoint host] componentsSeparatedByString:@"."] objectAtIndex:0];
self->_stsHostName = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"https://%@-sb.accesscontrol.windows.net",nameSpace]];
}
else
{
if([self->_stsHostName host] == nil)
{
NSLog(@"%@",@"StsHostname is not in URL format in connectionString.");
return FALSE;
}
self->_stsHostName = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"https://%@",[self->_stsHostName host]]];
}
if(self->_sharedSecret && !self->_sharedSecretIssurer )
{
self->_sharedSecretIssurer = @"owner";
}
return TRUE;
}
- (BOOL) setTokenWithRequest:(NSMutableURLRequest*)request error:(NSError**)error
{
NSString *token;
if( [self->_sharedAccessKey length] > 0)
{
token = [self PrepareSharedAccessTokenWithUrl:[request URL]];
}
else
{
NSMutableURLRequest *stsRequest = [self PrepareSharedSecretTokenWithUrl:[request URL] ];
NSHTTPURLResponse* response = nil;
NSError* requestError;
NSData* data = [[[SBURLConnection alloc] init] sendSynchronousRequest:stsRequest returningResponse:&response error:&requestError];
if(requestError && error)
{
NSLog(@"Fail to request token:");
NSLog(@"Response:%@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]);
(*error) = requestError;
return FALSE;
}
else
{
NSInteger statusCode = [response statusCode];
if( statusCode != 200 && statusCode != 201)
{
NSString* msg = [NSString stringWithFormat:@"Fail to request token. Response:%@",[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]];
NSLog(@"%@",msg);
if(error)
{
(*error) = [SBNotificationHubHelper errorWithMsg:msg code:statusCode];
}
return FALSE;
}
}
token = [SBTokenProvider ExtractToken:data];
}
[request addValue: token forHTTPHeaderField: @"Authorization"];
return TRUE;
}
- (NSString *)PrepareSharedAccessTokenWithUrl:(NSURL*)url
{
// time to live in seconds
NSTimeInterval interval = [[NSDate date] timeIntervalSince1970];
int totalSeconds = interval + self->timeToExpireinMins*60;
NSString* expiresOn = [NSString stringWithFormat:@"%d", totalSeconds];
NSString* audienceUri = [url absoluteString];
audienceUri = [[audienceUri lowercaseString] stringByReplacingOccurrencesOfString:@"https://" withString:@"http://"];
audienceUri = [[SBNotificationHubHelper urlEncode:audienceUri] lowercaseString];
NSString* signature = [SBNotificationHubHelper signString:[audienceUri stringByAppendingFormat:@"\n%@",expiresOn] withKey:self->_sharedAccessKey];
signature = [SBNotificationHubHelper urlEncode:signature];
NSString* token = [NSString stringWithFormat:@"SharedAccessSignature sr=%@&sig=%@&se=%@&skn=%@", audienceUri, signature, expiresOn, self->_sharedAccessKeyName];
return token;
}
- (NSMutableURLRequest *)PrepareSharedSecretTokenWithUrl:(NSURL*)url
{
NSString* audienceUri = [[url absoluteString] lowercaseString];
NSString* query = [url query];
if(query)
{
audienceUri = [audienceUri substringToIndex:([audienceUri length] - [query length]-1) ];
}
audienceUri = [audienceUri stringByReplacingOccurrencesOfString:@"https://" withString:@"http://"];
audienceUri = [SBNotificationHubHelper urlEncode:audienceUri];
//compute simpleWebToken
NSString* issurerStr = [NSString stringWithFormat:@"Issuer=%@", self->_sharedSecretIssurer];
NSData* secretBase64 = [SBNotificationHubHelper fromBase64:self->_sharedSecret];
NSString* signature = [SBNotificationHubHelper signString:issurerStr withKeyData:secretBase64.bytes keyLength:secretBase64.length];
signature = [SBNotificationHubHelper urlEncode:signature];
NSString* simpleWebToken = [NSString stringWithFormat:@"Issuer=%@&HMACSHA256=%@",self->_sharedSecretIssurer,signature];
simpleWebToken = [SBNotificationHubHelper urlEncode:simpleWebToken];
NSString* requestBody = [NSString stringWithFormat:@"wrap_scope=%@&wrap_assertion_format=SWT&wrap_assertion=%@", audienceUri, simpleWebToken];
//send request
NSURL* stsUri = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"%@/WRAPv0.9/",_stsHostName]];
NSMutableURLRequest *stsRequest=[NSMutableURLRequest requestWithURL:stsUri
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
[stsRequest setHTTPMethod:@"POST"];
[stsRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[stsRequest setValue:@"0" forHTTPHeaderField:@"ContentLength"];
[stsRequest setHTTPBody:[requestBody dataUsingEncoding:NSUTF8StringEncoding]];
return stsRequest;
}
- (void) setTokenWithRequest:(NSMutableURLRequest*)request completion:(void (^)(NSError*))completion
{
if( [self->_sharedAccessKey length] > 0)
{
[self setSharedAccessTokenWithRequest:request completion:completion];
}
else
{
[self setSharedSecretTokenAsync:request completion:completion];
}
}
- (void) setSharedAccessTokenWithRequest: (NSMutableURLRequest*)request completion:(void (^)(NSError*))completion
{
NSString *token = [self PrepareSharedAccessTokenWithUrl:[request URL]];
[request addValue: token forHTTPHeaderField: @"Authorization"];
if(completion)
{
completion(nil);
}
}
- (void) setSharedSecretTokenAsync: (NSMutableURLRequest*)request completion:(void (^)(NSError*))completion
{
NSMutableURLRequest *stsRequest = [self PrepareSharedSecretTokenWithUrl:[request URL]];
[[[SBURLConnection alloc] init] sendRequest:stsRequest completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error){
if(error)
{
if(completion)
{
completion(error);
}
return;
}
NSString* responseString = @"";
if(data)
{
responseString = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
}
NSInteger statusCode = [response statusCode];
if( statusCode != 200 && statusCode != 201)
{
NSLog(@"Fail to retrieve token.");
NSLog(@"%@",[request description]);
NSLog(@"Headers:%@",[request allHTTPHeaderFields]);
NSLog(@"Error Response:%@",responseString);
if(completion)
{
NSString* msg = [NSString stringWithFormat:@"Fail to retrieve token. Response:%@",responseString];
completion([SBNotificationHubHelper errorWithMsg:msg code:statusCode]);
}
return;
}
NSString* token = [SBTokenProvider ExtractToken:data];
if(completion)
{
if( [token length] == 0)
{
NSString* msg = [NSString stringWithFormat:@"Fail to parse token. Response:%@",responseString];
completion([SBNotificationHubHelper errorWithMsg:msg code:-1]);
}
else
{
[request addValue: token forHTTPHeaderField: @"Authorization"];
completion(nil);
}
}
} ];
}
+ (NSString *)ExtractToken:(NSData *)data
{
NSString *expireInSeconds;
NSString *token;
NSString* rawStr= [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSArray *fields = [rawStr componentsSeparatedByString:@"&"];
//Check size..
if([fields count] != 2)
{
NSLog(@"Wrong format of received token:%@",rawStr);
return @"";
}
for (NSString* item in fields) {
NSArray *subItems = [item componentsSeparatedByString:@"="];
NSString* key = [subItems objectAtIndex:0];
NSString* value = [SBNotificationHubHelper urlDecode:[subItems objectAtIndex:1]];
if([key isEqualToString:@"wrap_access_token"])
{
token = [NSString stringWithFormat:@"WRAP access_token=\"%@\"",value];
}
else
{
expireInSeconds = value;
}
}
return token;
}
@end

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

@ -0,0 +1,24 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBStaticHandlerResponse.h"
typedef void (^SBURLConnectionCompletion)(NSHTTPURLResponse*,NSData*,NSError*);
typedef SBStaticHandlerResponse* (^StaticHandleBlock)(NSURLRequest*);
@interface SBURLConnection : NSObject{
@private
NSURLRequest* _request;
NSHTTPURLResponse* _response;
SBURLConnectionCompletion _completion;
}
- (void) sendRequest: (NSURLRequest*) request completion:(void (^)(NSHTTPURLResponse*,NSData*,NSError*))completion;
- (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error;
+ (void) setStaticHandler:(StaticHandleBlock)staticHandler;
@end

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

@ -0,0 +1,122 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBURLConnection.h"
#import "SBNotificationHubHelper.h"
@implementation SBURLConnection
StaticHandleBlock _staticHandler;
+ (void) setStaticHandler:(StaticHandleBlock)staticHandler
{
_staticHandler = staticHandler;
}
- (void) sendRequest: (NSURLRequest*) request completion:(void (^)(NSHTTPURLResponse*,NSData*,NSError*))completion;
{
if( self){
self->_request = request;
self->_completion = completion;
}
if( _staticHandler != nil)
{
SBStaticHandlerResponse* mockResponse = _staticHandler(request);
if( mockResponse != nil)
{
if(completion)
{
NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[request URL] statusCode:200 HTTPVersion:nil headerFields:mockResponse.Headers];
completion(response,mockResponse.Data,nil);
}
return;
}
}
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(!theConnection && completion)
{
NSString* msg = [NSString stringWithFormat:@"Initiate request failed for %@",[request description]];
completion(nil,nil,[SBNotificationHubHelper errorWithMsg:msg code:-1]);
}
}
- (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error
{
if( _staticHandler != nil)
{
SBStaticHandlerResponse* mockResponse = _staticHandler(request);
if( mockResponse != nil)
{
(*response) = [[NSHTTPURLResponse alloc] initWithURL:[request URL] statusCode:200 HTTPVersion:nil headerFields:mockResponse.Headers];
return mockResponse.Data;
}
}
return [NSURLConnection sendSynchronousRequest:request returningResponse:response error:error];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
if(!self->_completion)
{
return;
}
self->_response = (NSHTTPURLResponse*)response;
NSInteger statusCode = [self->_response statusCode];
if( statusCode != 200 && statusCode != 201)
{
if(statusCode != 404)
{
NSLog(@"URLRequest failed:");
NSLog(@"URL:%@",[[self->_request URL] absoluteString]);
NSLog(@"Headers:%@",[self->_request allHTTPHeaderFields]);
}
NSString* msg = [NSString stringWithFormat:@"URLRequest failed for %@ with status code: %@",[self->_request description], [NSHTTPURLResponse localizedStringForStatusCode:statusCode]];
self->_completion(self->_response,nil,[SBNotificationHubHelper errorWithMsg:msg code:statusCode]);
self->_completion = nil;
return;
}
if([[self->_request HTTPMethod] isEqualToString:@"DELETE"])
{
self->_completion(self->_response,nil,nil);
self->_completion =nil;
return;
}
// if it's create registration id request, we need to execute callback here.
if([[self->_request HTTPMethod] isEqualToString:@"POST"] && [[self->_response URL].path rangeOfString:@"/registrationids" options:NSCaseInsensitiveSearch].location != NSNotFound)
{
self->_completion(self->_response,nil,nil);
self->_completion =nil;
return;
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
if( self->_completion)
{
self->_completion(self->_response,data,nil);
self->_completion = nil;
}
}
- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError *)error
{
if(self->_completion)
{
self->_completion(self->_response,nil,error);
self->_completion = nil;
}
}
@end

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

@ -0,0 +1,17 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBConnectionString : NSObject
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint issuer:(NSString*) issuer issuerSecret:(NSString*)secret;
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint fullAccessSecret:(NSString*)fullAccessSecret;
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint listenAccessSecret:(NSString*)listenAccessSecret;
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint sharedAccessKeyName:(NSString*)keyName accessSecret:(NSString*)secret;
@end

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

@ -0,0 +1,67 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBConnectionString.h"
#import "SBNotificationHubHelper.h"
@implementation SBConnectionString
NSString* const defaultListenSasRuleName = @"DefaultListenSharedAccessSignature";
NSString* const defaultFullSasRuleName = @"DefaultFullSharedAccessSignature";
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint issuer:(NSString*) issuer issuerSecret:(NSString*)secret
{
if(!endpoint || !issuer || !secret)
{
NSLog(@"endpoint/issuer/secret can't be null.");
return nil;
}
endpoint = [SBNotificationHubHelper modifyEndpoint:endpoint scheme:@"sb"];
NSString* endpointUri = [endpoint absoluteString];
if([[endpointUri lowercaseString] hasPrefix:@"endpoint="])
{
return [NSString stringWithFormat:@"%@;SharedSecretIssuer=%@;SharedSecretValue=%@",endpointUri,issuer,secret];
}
else
{
return [NSString stringWithFormat:@"Endpoint=%@;SharedSecretIssuer=%@;SharedSecretValue=%@",endpointUri,issuer,secret];
}
}
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint fullAccessSecret:(NSString*)fullAccessSecret
{
return [SBConnectionString stringWithEndpoint:endpoint sharedAccessKeyName:defaultFullSasRuleName accessSecret:fullAccessSecret];
}
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint listenAccessSecret:(NSString*)listenAccessSecret
{
return [SBConnectionString stringWithEndpoint:endpoint sharedAccessKeyName:defaultListenSasRuleName accessSecret:listenAccessSecret];
}
+ (NSString*) stringWithEndpoint:(NSURL*)endpoint sharedAccessKeyName:(NSString*)keyName accessSecret:(NSString*)secret
{
if(!endpoint || !keyName || !secret)
{
NSLog(@"endpoint/keyName/secret can't be null.");
return nil;
}
endpoint = [SBNotificationHubHelper modifyEndpoint:endpoint scheme:@"sb"];
NSString* endpointUri = [endpoint absoluteString];
if([[endpointUri lowercaseString] hasPrefix:@"endpoint="])
{
return [NSString stringWithFormat:@"%@;SharedAccessKeyName=%@;SharedAccessKey=%@",endpointUri,keyName,secret];
}
else
{
return [NSString stringWithFormat:@"Endpoint=%@;SharedAccessKeyName=%@;SharedAccessKey=%@",endpointUri,keyName,secret];
}
}
@end

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

@ -0,0 +1,36 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBNotificationHub : NSObject
{
@private
NSString* _path;
NSURL* _serviceEndPoint;
}
+ (NSString*) version;
- (SBNotificationHub*) initWithConnectionString:(NSString*) connectionString notificationHubPath:(NSString*)notificationHubPath;
// Async operations
- (void) registerNativeWithDeviceToken:(NSData*)deviceToken tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
- (void) registerTemplateWithDeviceToken:(NSData*)deviceToken name:(NSString*)name jsonBodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
- (void) unregisterNativeWithCompletion:(void (^)(NSError* error))completion;
- (void) unregisterTemplateWithName:(NSString*)name completion:(void (^)(NSError* error))completion;
- (void) unregisterAllWithDeviceToken:(NSData*)deviceToken completion:(void (^)(NSError* error))completion;
// sync operations
- (BOOL) registerNativeWithDeviceToken:(NSData*)deviceToken tags:(NSSet*)tags error:(NSError**)error;
- (BOOL) registerTemplateWithDeviceToken:(NSData*)deviceToken name:(NSString*)templateName jsonBodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags error:(NSError**)error;
- (BOOL) unregisterNativeWithError:(NSError**)error;
- (BOOL) unregisterTemplateWithName:(NSString*)name error:(NSError**)error;
- (BOOL) unregisterAllWithDeviceToken:(NSData*)deviceToken error:(NSError**)error;
@end

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

@ -0,0 +1,987 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBNotificationHub.h"
#import "SBNotificationHubHelper.h"
#import "SBTokenProvider.h"
#import "SBRegistrationParser.h"
#import "SBURLConnection.h"
#import "SBLocalStorage.h"
#import "SBRegistration.h"
#import "SBTemplateRegistration.h"
#import <UIKit/UIKit.h>
typedef void (^SBCompletion)(NSError*);
@interface SBThreadParameter : NSObject
@property (copy, nonatomic) NSArray* parameters;
@property (copy, nonatomic) NSString* deviceToken;
@property (copy, nonatomic) SBCompletion completion;
@property (nonatomic) BOOL isMainThread;
@end
@implementation SBThreadParameter
@synthesize parameters, completion, isMainThread, deviceToken;
@end
@implementation SBNotificationHub
NSString* const currentVersion = @"v0.1.6";
NSString* const _APIVersion = @"2013-04";
NSString* const _UserAgentTemplate = @"NOTIFICATIONHUBS/%@(api-origin=IosSdk; os=%@; os_version=%@;)";
SBTokenProvider* tokenProvider;
SBLocalStorage* storageManager;
- (SBNotificationHub*) initWithConnectionString:(NSString*) connectionString notificationHubPath:(NSString*)notificationHubPath
{
self = [super init];
if(!connectionString || !notificationHubPath)
{
return nil;
}
if( self){
NSDictionary* connnectionDictionary = [SBNotificationHubHelper parseConnectionString:connectionString];
NSString* endPoint = [connnectionDictionary objectForKey:@"endpoint"];
if(endPoint)
{
self->_serviceEndPoint = [[NSURL alloc] initWithString:endPoint];
}
if(self->_serviceEndPoint == nil || [self->_serviceEndPoint host] == nil)
{
NSLog(@"%@",@"Endpoint is missing or not in URL format in connectionString.");
return nil;
}
self->_path = notificationHubPath;
tokenProvider = [[SBTokenProvider alloc] initWithConnectionDictinary:connnectionDictionary];
if(tokenProvider == nil)
{
return nil;
}
storageManager = [[SBLocalStorage alloc] initWithNotificationHubPath:notificationHubPath];
if(storageManager == nil)
{
return nil;
}
}
return self;
}
- (NSString *)convertDeviceToken:(NSData *)deviceTokenData
{
NSString* newDeviceToken = [[[[[deviceTokenData description]
stringByReplacingOccurrencesOfString:@"<"withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString: @" " withString: @""] uppercaseString];
return newDeviceToken;
}
- (void) registerNativeWithDeviceToken:(NSData*)deviceTokenData tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
{
if( deviceTokenData == nil)
{
if(completion)
{
completion([SBNotificationHubHelper errorForNullDeviceToken]);
}
return;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
NSString* name = [SBRegistration Name];
NSString* payload = [SBRegistration payloadWithDeviceToken:deviceToken tags:tags];
if( storageManager.isRefreshNeeded)
{
NSString* refreshDeviceToken = [self getRefreshDeviceTokenWithNewDeviceToken:deviceToken];
[self retrieveAllRegistrationsWithDeviceToken:refreshDeviceToken completion:^(NSArray * regs, NSError * error)
{
if( error == nil)
{
[storageManager refreshFinishedWithDeviceToken:refreshDeviceToken];
[self createOrUpdateWith:name payload:payload deviceToken:deviceToken completion:completion];
}
else
{
if( completion)
{
completion(error);
}
}
}];
}
else
{
[self createOrUpdateWith:name payload:payload deviceToken:deviceToken completion:completion];
}
}
- (void) registerTemplateWithDeviceToken:(NSData*)deviceTokenData name:(NSString*)name jsonBodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags completion:(void (^)(NSError* error))completion;
{
if( deviceTokenData == nil)
{
if(completion)
{
completion([SBNotificationHubHelper errorForNullDeviceToken]);
}
return;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
NSError* error;
if( [self verifyTemplateName:name error:&error] == FALSE)
{
if(completion)
{
completion(error);
}
return;
}
NSString* payload = [SBTemplateRegistration payloadWithDeviceToken:deviceToken bodyTemplate:bodyTemplate expiryTemplate:expiryTemplate tags:tags templateName:name];
if( storageManager.isRefreshNeeded)
{
NSString* refreshDeviceToken = [self getRefreshDeviceTokenWithNewDeviceToken:deviceToken];
[self retrieveAllRegistrationsWithDeviceToken:refreshDeviceToken completion:^(NSArray * regs, NSError * error)
{
if( error == nil)
{
[storageManager refreshFinishedWithDeviceToken:refreshDeviceToken];
[self createOrUpdateWith:name payload:payload deviceToken:deviceToken completion:completion];
}
else
{
if( completion)
{
completion(error);
}
}
}];
}
else
{
[self createOrUpdateWith:name payload:payload deviceToken:deviceToken completion:completion];
}
}
- (void)createOrUpdateWith:(NSString *)name payload:(NSString *)payload deviceToken:(NSString *)deviceToken completion:(void (^)(NSError *))completion
{
StoredRegistrationEntry* cached = [storageManager getStoredRegistrationEntryWithRegistrationName:name];
if(cached == nil)
{
[self createRegistrationIdAndUpsert:name payload:payload deviceToken:deviceToken completion:^(NSError *error)
{
if( error != nil && [error code]== 410)
{
[self createRegistrationIdAndUpsert:name payload:payload deviceToken:deviceToken completion:completion];
}
else
{
if(completion)
{
completion(error);
}
}
}];
}
else
{
[self upsertRegistrationWithName:name registrationId:cached.RegistrationId payload:payload completion:^(NSError *error)
{
if( error != nil && [error code]== 410)
{
[self createRegistrationIdAndUpsert:name payload:payload deviceToken:deviceToken completion:completion];
}
else
{
if( completion)
{
completion(error);
}
}
}];
}
}
- (void)createRegistrationIdAndUpsert:(NSString*)name payload:(NSString*)payload deviceToken:(NSString*)deviceToken completion:(void (^)(NSError*))completion
{
NSURL *requestUri = [self composeCreateRegistrationIdUri];
[self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"POST" ETag:@"" completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if(!error)
{
NSURL* locationUrl = [[NSURL alloc] initWithString:[[response allHeaderFields] objectForKey:@"Location"]];
NSString *registrationId = [self extractRegistrationIdFromLocationUri:locationUrl];
[storageManager updateWithRegistrationName:name registrationId:registrationId eTag:@"*" deviceToken:deviceToken];
[self upsertRegistrationWithName:name registrationId:registrationId payload:payload completion:completion];
}
else
{
if(completion)
{
completion(error);
}
}
}];
}
- (void)upsertRegistrationWithName:(NSString*)name registrationId:(NSString*)registrationId payload:(NSString*)payload completion:(void (^)(NSError*))completion
{
NSURL *requestUri = [self composeRegistrationUriWithRegistrationId: registrationId];
[self registrationOperationWithRequestUri:requestUri payload:payload httpMethod:@"PUT" ETag:@"" completion:^(NSHTTPURLResponse *response1, NSData *data, NSError *error) {
if(!error)
{
[self parseResultAndUpdateWithName:name data:data error:&error];
}
if(completion)
{
completion(error);
}
}];
}
- (void)parseResultAndUpdateWithName:(NSString *)name data:(NSData *)data error:(NSError **)error
{
NSError* parseError;
NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&parseError];
if( !parseError)
{
[storageManager updateWithRegistrationName:name registration:(SBRegistration*)[registrations objectAtIndex:0]];
}
else if( error)
{
(*error) = parseError;
}
}
- (void) retrieveAllRegistrationsWithDeviceToken:(NSString*)deviceToken completion:(void (^)(NSArray*, NSError*))completion
{
NSURL *requestUri = [self composeRetrieveAllRegistrationsUriWithDeviceToken:deviceToken];
[self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"GET" ETag:@"" completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if(error)
{
if([error code]==404)
{
if(completion)
{
completion(nil,nil);
}
return;
}
else
{
if(completion)
{
completion(nil,error);
}
return;
}
}
NSError *parseError;
NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&parseError];
if( parseError)
{
if(completion)
{
completion(nil,parseError);
}
return;
}
for (SBRegistration* retrieved in registrations)
{
[storageManager updateWithRegistration:retrieved];
}
if(completion)
{
completion(registrations,nil);
}
}];
}
- (void) unregisterNativeWithCompletion:(void (^)(NSError*))completion
{
[self deleteRegistrationWithName:[SBRegistration Name] completion:completion];
}
- (void) unregisterTemplateWithName:(NSString*)name completion:(void (^)(NSError*))completion
{
NSError* error;
if( [self verifyTemplateName:name error:&error] == FALSE)
{
if(completion)
{
completion(error);
}
return;
}
[self deleteRegistrationWithName:name completion:completion];
}
- (void) deleteRegistrationWithName:(NSString*)templateName completion:(void (^)(NSError*))completion
{
StoredRegistrationEntry* cached = [storageManager getStoredRegistrationEntryWithRegistrationName:templateName];
if(cached == nil)
{
if(completion)
{
completion(nil);
}
return;
}
NSURL *requestUri = [self composeRegistrationUriWithRegistrationId: cached.RegistrationId];
[self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"DELETE" ETag:@"*" completion:^(NSHTTPURLResponse *response, NSData *data, NSError *error) {
if( error == nil || [error code] == 404 )
{
[storageManager deleteWithRegistrationName:templateName];
error = nil;
}
if(completion)
{
completion(error);
}
}];
}
- (void) unregisterAllWithDeviceToken:(NSData*)deviceTokenData completion:(void (^)(NSError*))completion
{
if( deviceTokenData == nil)
{
if(completion)
{
completion([SBNotificationHubHelper errorForNullDeviceToken]);
}
return;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
SBThreadParameter* parameter = [[SBThreadParameter alloc]init];
parameter.deviceToken = deviceToken;
parameter.completion = completion;
parameter.isMainThread = [[NSThread currentThread] isMainThread];
[self performSelectorInBackground:@selector(deleteAllRegistrationThread:) withObject:parameter];
}
- (void) deleteAllRegistrationThread:(SBThreadParameter*)parameter
{
NSError* error;
NSArray* registrations = [self retrieveAllRegistrationsWithDeviceToken:parameter.deviceToken error:&error];
if(registrations.count != 0)
{
for(SBRegistration* reg in registrations)
{
NSString* name = [SBNotificationHubHelper nameOfRegistration:reg];
[self deleteRegistrationWithName:name error:&error];
if(error)
{
break;
}
}
}
if (!error)
{
// Remove any registrations that are only in the client and not on server
[storageManager deleteAllRegistrations];
}
if(parameter.completion)
{
if( parameter.isMainThread)
{
// callback on main thread
dispatch_async(dispatch_get_main_queue(), ^{parameter.completion(error);});
}
else
{
parameter.completion(error);
}
}
}
- (BOOL) registerNativeWithDeviceToken:(NSData*)deviceTokenData tags:(NSSet*)tags error:(NSError**)error
{
if( deviceTokenData == nil)
{
if(error)
{
*error = [SBNotificationHubHelper errorForNullDeviceToken];
}
return FALSE;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
NSString* name =[SBRegistration Name];
NSString* payload = [SBRegistration payloadWithDeviceToken:deviceToken tags:tags];
if( storageManager.isRefreshNeeded)
{
NSString* refreshDeviceToken = [self getRefreshDeviceTokenWithNewDeviceToken:deviceToken];
NSError* retrieveError;
[self retrieveAllRegistrationsWithDeviceToken:refreshDeviceToken error:&retrieveError];
if( retrieveError )
{
if( error)
{
*error = retrieveError;
}
return FALSE;
}
[storageManager refreshFinishedWithDeviceToken:refreshDeviceToken];
}
return [self createorUpdateWith:name payload:payload deviceToken:deviceToken error:error];
}
- (BOOL) registerTemplateWithDeviceToken:(NSData*)deviceTokenData name:(NSString*)templateName jsonBodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags error:(NSError**)error
{
if( deviceTokenData == nil)
{
if(error)
{
*error = [SBNotificationHubHelper errorForNullDeviceToken];
}
return FALSE;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
if( [self verifyTemplateName:templateName error:error] == FALSE)
{
return FALSE;
}
NSString* payload = [SBTemplateRegistration payloadWithDeviceToken:deviceToken bodyTemplate:bodyTemplate expiryTemplate:expiryTemplate tags:tags templateName:templateName];
if( storageManager.isRefreshNeeded)
{
NSString* refreshDeviceToken = [self getRefreshDeviceTokenWithNewDeviceToken:deviceToken];
NSError* retrieveError;
[self retrieveAllRegistrationsWithDeviceToken:refreshDeviceToken error:&retrieveError];
if( retrieveError )
{
if( error)
{
*error = retrieveError;
}
return FALSE;
}
[storageManager refreshFinishedWithDeviceToken:refreshDeviceToken];
}
return [self createorUpdateWith:templateName payload:payload deviceToken:deviceToken error:error];
}
- (BOOL)createorUpdateWith:(NSString *)name payload:(NSString *)payload deviceToken:(NSString *)deviceToken error:(NSError**)error
{
StoredRegistrationEntry* cached = [storageManager getStoredRegistrationEntryWithRegistrationName:name];
NSString *registrationId;
if(cached == nil)
{
NSError *createRegistrationError;
registrationId = [self createRegistrationId:&createRegistrationError];
if (createRegistrationError)
{
if (error)
{
*error = createRegistrationError;
}
return false;
}
[storageManager updateWithRegistrationName:name registrationId:registrationId eTag:@"*" deviceToken:deviceToken];
}
else
{
registrationId = cached.RegistrationId;
}
NSError *upsertRegistrationError;
BOOL result = [self upsertRegistrationWithName:name registrationId:registrationId payload:payload error:&upsertRegistrationError];
if( upsertRegistrationError != nil && [upsertRegistrationError code] == 410)
{
// if we get 410 from service, we will recreate registration id and will try to do upsert
NSError *retrieveRegistrationError;
registrationId = [self createRegistrationId:&retrieveRegistrationError];
if (retrieveRegistrationError)
{
if (error)
{
*error = retrieveRegistrationError;
}
return false;
}
[storageManager updateWithRegistrationName:name registrationId:registrationId eTag:@"*" deviceToken:deviceToken];
NSError *operationError;
result = [self upsertRegistrationWithName:name registrationId:registrationId payload:payload error:&operationError];
if (operationError)
{
if (error)
{
*error = operationError;
}
}
return result;
}
if(error)
{
(*error) = upsertRegistrationError;
}
return result;
}
- (NSString*)createRegistrationId:(NSError**)error
{
NSURL *requestUri = [self composeCreateRegistrationIdUri];
NSHTTPURLResponse* response=nil;
NSData* data;
NSError* operationError;
[self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"POST" ETag:@"" response:&response responseData:&data error:&operationError];
if(operationError == nil)
{
NSURL* locationUrl = [[NSURL alloc] initWithString:[[response allHeaderFields] objectForKey:@"Location"]];
return [self extractRegistrationIdFromLocationUri:locationUrl];
}
if(error)
{
*error = operationError;
}
return nil;
}
- (BOOL)createRegistrationWithName:(NSString*)name payload:(NSString*)payload error:(NSError**)error
{
NSURL *requestUri = [self composeRegistrationUriWithRegistrationId: @""];
NSHTTPURLResponse* response=nil;
NSData* data;
NSError* operationError;
BOOL result = [self registrationOperationWithRequestUri:requestUri payload:payload httpMethod:@"POST" ETag:@"" response:&response responseData:&data error:&operationError];
if( operationError == nil)
{
NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&operationError];
if( operationError == nil)
{
[storageManager updateWithRegistrationName:name registration:(SBRegistration*)[registrations objectAtIndex:0]];
}
}
if(error)
{
*error = operationError;
}
return result;
}
- (BOOL)upsertRegistrationWithName:(NSString*)name registrationId:(NSString*)registrationId payload:(NSString*)payload error:(NSError**)error
{
NSURL *requestUri = [self composeRegistrationUriWithRegistrationId: registrationId];
NSHTTPURLResponse* response=nil;
NSData* data;
NSError* operationError;
BOOL result = [self registrationOperationWithRequestUri:requestUri payload:payload httpMethod:@"PUT" ETag:@"" response:&response responseData:&data error:&operationError];
if( operationError == nil)
{
NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&operationError];
if( operationError == nil)
{
[storageManager updateWithRegistrationName:name registration:(SBRegistration*)[registrations objectAtIndex:0]];
}
}
if(error)
{
*error = operationError;
}
return result;
}
// This function will retrieve all registrations and update local storage with them.
- (NSArray*) retrieveAllRegistrationsWithDeviceToken:(NSString*)deviceToken error:(NSError**)error
{
NSURL *requestUri = [self composeRetrieveAllRegistrationsUriWithDeviceToken:deviceToken];
NSHTTPURLResponse* response=nil;
NSData* data;
NSError* operationError;
[self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"GET" ETag:@"" response:&response responseData:&data error:&operationError];
if(operationError)
{
if([operationError code]==404)
{
//no registrations
return nil;
}
if( error)
{
(*error) = operationError;
}
return nil;
}
NSError *parseError;
NSArray *registrations = [SBRegistrationParser parseRegistrations:data error:&parseError];
if(parseError)
{
if( error)
{
(*error) = parseError;
}
}
else
{
[storageManager deleteAllRegistrations];
for (SBRegistration* retrieved in registrations)
{
[storageManager updateWithRegistration:retrieved];
}
}
return registrations;
}
- (BOOL) unregisterNativeWithError:(NSError**)error
{
return [self deleteRegistrationWithName:[SBRegistration Name] error:error];
}
- (BOOL) unregisterTemplateWithName:(NSString*)name error:(NSError**)error
{
if( [self verifyTemplateName:name error:error] == FALSE)
{
return FALSE;
}
return [self deleteRegistrationWithName:name error:error];
}
- (BOOL) deleteRegistrationWithName:(NSString*)name error:(NSError**)error
{
StoredRegistrationEntry* cached = [storageManager getStoredRegistrationEntryWithRegistrationName:name];
if(cached == nil)
{
return true;
}
NSURL *requestUri = [self composeRegistrationUriWithRegistrationId: cached.RegistrationId];
NSURLResponse* response=nil;
NSData* data;
NSError* operationError;
BOOL result = [self registrationOperationWithRequestUri:requestUri payload:@"" httpMethod:@"DELETE" ETag:@"*" response:&response responseData:&data error:&operationError];
if( operationError == nil || [operationError code] == 404 )
{
// don't return error for not-found
[storageManager deleteWithRegistrationName:name];
error = nil;
}
if(error != nil)
{
*error = operationError;
}
return result;
}
- (BOOL) unregisterAllWithDeviceToken:(NSData*)deviceTokenData error:(NSError**)error
{
if( deviceTokenData == nil)
{
if(error)
{
*error = [SBNotificationHubHelper errorForNullDeviceToken];
}
return FALSE;
}
NSString* deviceToken = [self convertDeviceToken:deviceTokenData];
NSError* operationError;
NSArray* registrations = [self retrieveAllRegistrationsWithDeviceToken:deviceToken error:&operationError];
if( operationError )
{
if(error)
{
*error = operationError;
}
return FALSE;
}
for (SBRegistration* reg in registrations) {
NSString* name = [SBNotificationHubHelper nameOfRegistration:reg];
[self deleteRegistrationWithName:name error:&operationError];
if(operationError)
{
if(error)
{
*error = operationError;
}
return FALSE;
}
}
// Remove any registrations that are only in the client and not on server
[storageManager deleteAllRegistrations];
return TRUE;
}
- (BOOL) verifyTemplateName:(NSString*)name error:(NSError**)error
{
if( [name isEqualToString: [SBRegistration Name]])
{
if(error)
{
*error = [SBNotificationHubHelper errorForReservedTemplateName];
}
return FALSE;
}
NSRange range = [name rangeOfString:@":"];
if (range.length > 0)
{
if(error)
{
*error = [SBNotificationHubHelper errorForInvalidTemplateName];
}
}
return TRUE;
}
- (void) registrationOperationWithRequestUri:(NSURL*)requestUri payload:(NSString*)payload httpMethod:(NSString*) httpMethod ETag:(NSString*)etag completion:(void (^)(NSHTTPURLResponse *response, NSData *data, NSError *error))completion
{
NSMutableURLRequest *theRequest = [self PrepareUrlRequest:requestUri httpMethod:httpMethod ETag:etag payload:payload];
[tokenProvider setTokenWithRequest:theRequest completion:^(NSError *error) {
if(error)
{
if(completion)
{
completion(nil,nil,error);
}
return;
}
[[[SBURLConnection alloc] init] sendRequest:theRequest completion:completion];
} ];
}
- (BOOL) registrationOperationWithRequestUri:(NSURL*)requestUri payload:(NSString*)payload httpMethod:(NSString*) httpMethod ETag:(NSString*)etag response:(NSHTTPURLResponse**)response responseData:(NSData**)responseData error:(NSError**)error
{
NSMutableURLRequest *theRequest = [self PrepareUrlRequest:requestUri httpMethod:httpMethod ETag:etag payload:payload];
[tokenProvider setTokenWithRequest:theRequest error:error];
if(*error != nil)
{
return FALSE;
}
//send synchronously
(*responseData) = [[[SBURLConnection alloc] init] sendSynchronousRequest:theRequest returningResponse:response error:error];
if(*error != nil)
{
NSLog(@"Fail to perform registration operation.");
NSLog(@"%@",[theRequest description]);
NSLog(@"Headers:%@",[theRequest allHTTPHeaderFields]);
NSLog(@"Error Response:%@",[[NSString alloc]initWithData:(*responseData) encoding:NSUTF8StringEncoding]);
return FALSE;
}
else
{
NSInteger statusCode = [(*response) statusCode];
if( statusCode != 200 && statusCode != 201)
{
NSString* responseString = [[NSString alloc]initWithData:(*responseData) encoding:NSUTF8StringEncoding];
if(statusCode != 404)
{
NSLog(@"Fail to perform registration operation.");
NSLog(@"%@",[theRequest description]);
NSLog(@"Headers:%@",[theRequest allHTTPHeaderFields]);
NSLog(@"Error Response:%@",responseString);
}
if(error)
{
NSString* msg = [NSString stringWithFormat:@"Fail to perform registration operation. Response:%@",responseString];
(*error) = [SBNotificationHubHelper errorWithMsg:msg code:statusCode];
}
return FALSE;
}
}
return TRUE;
}
- (NSURL*) composeRetrieveAllRegistrationsUriWithDeviceToken:(NSString*)deviceToken
{
NSString* fullPath = [NSString stringWithFormat:@"%@%@/Registrations/?$filter=deviceToken+eq+'%@'&api-version=%@", [self->_serviceEndPoint absoluteString],self->_path, deviceToken, _APIVersion];
return[[NSURL alloc] initWithString: fullPath];
}
- (NSURL*) composeRegistrationUriWithRegistrationId:(NSString*)registrationId
{
if( registrationId == nil)
{
registrationId = @"";
}
NSString* fullPath = [NSString stringWithFormat:@"%@%@/Registrations/%@?api-version=%@", [self->_serviceEndPoint absoluteString],self->_path, registrationId, _APIVersion];
return[[NSURL alloc] initWithString: fullPath];
}
- (NSURL*) composeCreateRegistrationIdUri
{
NSString* fullPath = [NSString stringWithFormat:@"%@%@/registrationids/?api-version=%@", [self->_serviceEndPoint absoluteString],self->_path, _APIVersion];
return[[NSURL alloc] initWithString: fullPath];
}
- (NSMutableURLRequest *)PrepareUrlRequest:(NSURL *)uri httpMethod:(NSString *)httpMethod ETag:(NSString*)etag payload:(NSString *)payload {
NSMutableURLRequest *theRequest;
theRequest = [NSMutableURLRequest requestWithURL:uri
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
[theRequest setHTTPMethod:httpMethod];
if( [payload hasPrefix:@"{"])
{
[theRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
}
else
{
[theRequest setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
}
if( etag != nil && [etag length]>0)
{
if( ![etag isEqualToString:@"*"])
{
etag = [NSString stringWithFormat:@"\"%@\"",etag];
}
[theRequest addValue: etag forHTTPHeaderField: @"If-Match"];
}
if( [payload length]>0){
NSString* requestBody = [NSString stringWithFormat:@"%@",payload];
[theRequest setHTTPBody:[requestBody dataUsingEncoding:NSUTF8StringEncoding]];
}
NSString *userAgent = [NSString stringWithFormat: _UserAgentTemplate, _APIVersion, [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]];
[theRequest addValue:userAgent forHTTPHeaderField:@"User-Agent"];
return theRequest;
}
// if there is deviceToken from localstorage, we should use it.
- (NSString*) getRefreshDeviceTokenWithNewDeviceToken:(NSString*)newDeviceToken
{
NSString* deviceToken = [storageManager deviceToken];
if( deviceToken == nil || [deviceToken length]==0 )
{
return newDeviceToken;
}
else
{
return deviceToken;
}
}
+ (NSString*) version
{
return currentVersion;
}
-(NSString*) extractRegistrationIdFromLocationUri:(NSURL*) locationUrl
{
NSMutableCharacterSet *trimCharacterSet = [NSMutableCharacterSet whitespaceAndNewlineCharacterSet];
[trimCharacterSet addCharactersInString:@"/"];
NSString *regisrationIdPath = [locationUrl.path stringByTrimmingCharactersInSet:trimCharacterSet];
NSRange lastIndex = [regisrationIdPath rangeOfString:@"/" options:NSBackwardsSearch];
NSString *registrationId = [regisrationIdPath substringFromIndex:lastIndex.location+1];
return registrationId;
}
@end

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

@ -0,0 +1,22 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
@interface SBRegistration : NSObject
@property (copy, nonatomic) NSString* ETag;
@property (copy, nonatomic) NSDate* expiresAt;
@property (copy, nonatomic) NSSet* tags;
@property (copy, nonatomic) NSString* registrationId;
@property (copy, nonatomic) NSString* deviceToken;
+ (NSString*) Name;
+ (NSString*) payloadWithDeviceToken:(NSString*)deviceToken tags:(NSSet*)tags;
@end

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

@ -0,0 +1,34 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBRegistration.h"
#import "SBNotificationHubHelper.h"
@implementation SBRegistration
NSString* const nativeRegistrationName = @"$Default";
NSString* const nativeRegistrationFormat = @"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\">%@<DeviceToken>%@</DeviceToken></AppleRegistrationDescription></content></entry>";
@synthesize ETag, expiresAt, tags, deviceToken, registrationId;
+ (NSString*) Name
{
return nativeRegistrationName;
}
+ (NSString*) payloadWithDeviceToken:(NSString*)deviceToken tags:(NSSet*)tags
{
NSString* tagNode = @"";
NSString* tagString = [SBNotificationHubHelper convertTagSetToString:tags];
if( [tagString length]>0)
{
tagNode = [NSString stringWithFormat:@"<Tags>%@</Tags>", tagString];
}
return [NSString stringWithFormat:nativeRegistrationFormat, tagNode, deviceToken];
}
@end

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

@ -0,0 +1,16 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import <Foundation/Foundation.h>
#import "SBRegistration.h"
@interface SBTemplateRegistration : SBRegistration
@property (copy, nonatomic) NSString* bodyTemplate;
@property (copy, nonatomic) NSString* expiry;
@property (copy, nonatomic) NSString* templateName;
+ (NSString*) payloadWithDeviceToken:(NSString*)deviceToken bodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags templateName:(NSString *)templateName;
@end

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

@ -0,0 +1,32 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBTemplateRegistration.h"
#import "SBNotificationHubHelper.h"
@implementation SBTemplateRegistration
NSString* const templateRegistrationFormat = @"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleTemplateRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\">%@<DeviceToken>%@</DeviceToken><BodyTemplate><![CDATA[%@]]></BodyTemplate>%@<TemplateName>%@</TemplateName></AppleTemplateRegistrationDescription></content></entry>";
@synthesize bodyTemplate, expiry, templateName;
+ (NSString*) payloadWithDeviceToken:(NSString*)deviceToken bodyTemplate:(NSString*)bodyTemplate expiryTemplate:(NSString*)expiryTemplate tags:(NSSet*)tags templateName:(NSString *)templateName
{
NSString* expiryFullString = @"";
if(expiryTemplate && [expiryTemplate length]>0)
{
expiryFullString = [NSString stringWithFormat:@"<Expiry>%@</Expiry>",expiryTemplate];
}
NSString* tagNode = @"";
NSString* tagString = [SBNotificationHubHelper convertTagSetToString:tags];
if( [tagString length]>0)
{
tagNode = [NSString stringWithFormat:@"<Tags>%@</Tags>", tagString];
}
return [NSString stringWithFormat:templateRegistrationFormat, tagNode, deviceToken, bodyTemplate, expiryFullString, templateName];
}
@end

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

@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'WindowsAzureMessaging' target in the 'WindowsAzureMessaging' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif

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

@ -0,0 +1,7 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
#import "SBNotificationHub.h"
#import "SBConnectionString.h"

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

@ -0,0 +1,27 @@
//
// TestHelper.h
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 2/1/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TestHelper : NSObject
+ (NSString*) verifyHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody;
+ (NSString*) verifySASHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody;
+ (NSString*) verifyACSHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody;
+ (NSString*) verifyCustomizedTokenHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody;
+ (NSString*) verifyETagWithRequest:(NSURLRequest *)request ETag:(NSString*) etag;
+ (void) updateSettingWithVersion:(BOOL)addVersion registrations:(BOOL)addRegistrations useOldVersion:(BOOL)useOldVersion;
+ (BOOL) verifySettingWithDeviceToken:(NSString*)deviceToken EmptyRegistrations:(BOOL)emptyRegistrations;
@end

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

@ -0,0 +1,184 @@
//
// TestHelper.m
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 2/1/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import "TestHelper.h"
#import "SBNotificationHub.h"
@implementation TestHelper
+ (NSString*) verifyHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody
{
NSString* httpMethod = [request HTTPMethod];
if(![httpMethod isEqualToString:expectedMethod])
{
NSLog(@"HttpMethod:%@",httpMethod);
return @"HttpMethod is not correct.";
}
NSString* url = [[request URL] absoluteString];
if(![url isEqualToString:expectedUrl])
{
NSLog(@"URL:%@",url);
return @"Url is not correct.";
}
NSString* bodyText = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];
if(![bodyText isEqualToString:expectedBody])
{
NSLog(@"Body:%@",bodyText);
return @"Body is not correct.";
}
return nil;
}
+ (NSString*) verifySASHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody
{
NSString* ret = [TestHelper verifyHttpRequest:request httpMethod:expectedMethod url:expectedUrl body:expectedBody];
if(ret)
{
return ret;
}
NSDictionary* headers = [request allHTTPHeaderFields];
if( ![[headers objectForKey:@"Content-Type"] isEqualToString:@"application/xml"] ||
![[headers objectForKey:@"Authorization"] hasPrefix:@"SharedAccessSignature sr="] ||
![[headers objectForKey:@"User-Agent"] hasPrefix:@"NOTIFICATIONHUBS/"] ||
[[headers objectForKey:@"User-Agent"] rangeOfString:@"api-origin=IosSdk"].location == NSNotFound)
{
NSLog(@"Headers:%@",headers);
return @"Header is not correct.";
}
return nil;
}
+ (NSString*) verifyACSHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody
{
NSString* ret = [TestHelper verifyHttpRequest:request httpMethod:expectedMethod url:expectedUrl body:expectedBody];
if(ret)
{
return ret;
}
NSDictionary* headers = [request allHTTPHeaderFields];
if( ![[headers objectForKey:@"Content-Type"] isEqualToString:@"application/xml"] ||
![[headers objectForKey:@"Authorization"] isEqualToString:@"WRAP access_token=\"newToken\""])
{
NSLog(@"Headers:%@",headers);
return @"Header is not correct.";
}
return nil;
}
+ (NSString*) verifyETagWithRequest:(NSURLRequest *)request ETag:(NSString*) etag
{
if( ![etag isEqualToString:@"*"])
{
etag = [NSString stringWithFormat:@"\"%@\"",etag];
}
NSDictionary* headers = [request allHTTPHeaderFields];
if( ![[headers objectForKey:@"If-Match"] isEqualToString:etag])
{
NSLog(@"Headers:%@",headers);
return @"ETag is not correct.";
}
return nil;
}
+ (NSString*) verifyCustomizedTokenHttpRequest:(NSURLRequest *)request httpMethod:(NSString*)expectedMethod url:(NSString*)expectedUrl body:(NSString*)expectedBody
{
NSString* ret = [TestHelper verifyHttpRequest:request httpMethod:expectedMethod url:expectedUrl body:expectedBody];
if(ret)
{
return ret;
}
NSDictionary* headers = [request allHTTPHeaderFields];
if( ![[headers objectForKey:@"Content-Type"] isEqualToString:@"application/xml"] ||
![[headers objectForKey:@"Authorization"] isEqualToString:@"newToken"])
{
NSLog(@"Headers:%@",headers);
return @"Header is not correct.";
}
return nil;
}
+ (void) updateSettingWithVersion:(BOOL)addVersion registrations:(BOOL)addRegistrations useOldVersion:(BOOL)useOldVersion
{
NSString* current_storageVersion = @"v1.0.0";
NSString* deviceToken = @"3131";
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if(addVersion)
{
if( useOldVersion)
{
[defaults setObject:@"v0.0.1" forKey:@"PushTest-version"];
}
else
{
[defaults setObject:current_storageVersion forKey:@"PushTest-version"];
}
[defaults setObject:deviceToken forKey:@"PushTest-deviceToken"];
}
else
{
[defaults removeObjectForKey:@"PushTest-deviceToken"];
[defaults removeObjectForKey:@"PushTest-version"];
}
if( addRegistrations)
{
NSMutableArray* registrations = [[NSMutableArray alloc] initWithObjects:@"$Default:myRegId1:1",@"regName:myRegId2:1", nil];
[defaults setObject:registrations forKey:@"PushTest-registrations"];
}
else
{
[defaults removeObjectForKey:@"PushTest-registrations"];
}
[defaults synchronize];
}
+ (BOOL) verifySettingWithDeviceToken:(NSString*)deviceToken EmptyRegistrations:(BOOL)emptyRegistrations
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString* storedDeviceToken = [defaults objectForKey:@"PushTest-deviceToken"];
if(deviceToken != nil && ![storedDeviceToken isEqualToString:deviceToken])
{
return FALSE;
}
NSArray* registrations = [defaults objectForKey:@"PushTest-registrations"];
if( emptyRegistrations)
{
return registrations == nil;
}
else
{
if( ( [[registrations objectAtIndex:1] isEqualToString:@"$Default:myRegId1:1"] &&
[[registrations objectAtIndex:0] isEqualToString:@"regName:myRegId2:2"]) ||
([[registrations objectAtIndex:0] isEqualToString:@"$Default:myRegId1:1"] &&
[[registrations objectAtIndex:1] isEqualToString:@"regName:myRegId2:2"]) )
{
return TRUE;
}
return FALSE;
}
}
@end

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

@ -0,0 +1,562 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
8471C92F16F3DED000C73674 /* SBLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8471C92E16F3DED000C73674 /* SBLocalStorage.m */; };
848CB70E16FBE68700183E8D /* SBTemplateRegistration.m in Sources */ = {isa = PBXBuildFile; fileRef = 848CB70D16FBE68700183E8D /* SBTemplateRegistration.m */; };
848CB74016FCC8C100183E8D /* SBStoredRegistrationEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 848CB73F16FCC8C100183E8D /* SBStoredRegistrationEntry.m */; };
924E069D185BC3C50078E879 /* SBStaticHandlerResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 924E069C185BC3C50078E879 /* SBStaticHandlerResponse.m */; };
A3C2060816B9FC0B00158A35 /* SBConnectionString.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2060116B9FC0B00158A35 /* SBConnectionString.m */; };
A3C2060916B9FC0B00158A35 /* SBNotificationHub.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2060316B9FC0B00158A35 /* SBNotificationHub.m */; };
A3C2060B16B9FC0B00158A35 /* SBRegistration.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2060716B9FC0B00158A35 /* SBRegistration.m */; };
A3C2061416B9FC1900158A35 /* SBNotificationHubHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2060D16B9FC1900158A35 /* SBNotificationHubHelper.m */; };
A3C2061516B9FC1900158A35 /* SBRegistrationParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2060F16B9FC1900158A35 /* SBRegistrationParser.m */; };
A3C2061616B9FC1900158A35 /* SBTokenProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2061116B9FC1900158A35 /* SBTokenProvider.m */; };
A3C2061716B9FC1900158A35 /* SBURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2061316B9FC1900158A35 /* SBURLConnection.m */; };
A3C2064616BC3F3300158A35 /* TestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C2064516BC3F3300158A35 /* TestHelper.m */; };
A3C669AF16A8DB4300CEA9F3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669AE16A8DB4300CEA9F3 /* UIKit.framework */; };
A3C669B116A8DB4300CEA9F3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669B016A8DB4300CEA9F3 /* Foundation.framework */; };
A3C669B316A8DB4300CEA9F3 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669B216A8DB4300CEA9F3 /* CoreGraphics.framework */; };
A3C669B916A8DB4300CEA9F3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A3C669B716A8DB4300CEA9F3 /* InfoPlist.strings */; };
A3C669BB16A8DB4300CEA9F3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C669BA16A8DB4300CEA9F3 /* main.m */; };
A3C669BF16A8DB4300CEA9F3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C669BE16A8DB4300CEA9F3 /* AppDelegate.m */; };
A3C669C216A8DB4300CEA9F3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C669C116A8DB4300CEA9F3 /* ViewController.m */; };
A3C669C516A8DB4300CEA9F3 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3C669C316A8DB4300CEA9F3 /* ViewController_iPhone.xib */; };
A3C669C816A8DB4300CEA9F3 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = A3C669C616A8DB4300CEA9F3 /* ViewController_iPad.xib */; };
A3C669D016A8DB4300CEA9F3 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669CF16A8DB4300CEA9F3 /* SenTestingKit.framework */; };
A3C669D116A8DB4300CEA9F3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669AE16A8DB4300CEA9F3 /* UIKit.framework */; };
A3C669D216A8DB4300CEA9F3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3C669B016A8DB4300CEA9F3 /* Foundation.framework */; };
A3C669DA16A8DB4300CEA9F3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A3C669D816A8DB4300CEA9F3 /* InfoPlist.strings */; };
A3C669DD16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A3C669DC16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
A3C669D316A8DB4300CEA9F3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A3C669A116A8DB4300CEA9F3 /* Project object */;
proxyType = 1;
remoteGlobalIDString = A3C669A916A8DB4300CEA9F3;
remoteInfo = WindowsAzureMessagingTest;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
8471C92D16F3DED000C73674 /* SBLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBLocalStorage.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBLocalStorage.h; sourceTree = "<group>"; };
8471C92E16F3DED000C73674 /* SBLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBLocalStorage.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBLocalStorage.m; sourceTree = "<group>"; };
848CB70C16FBE68700183E8D /* SBTemplateRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTemplateRegistration.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBTemplateRegistration.h; sourceTree = "<group>"; };
848CB70D16FBE68700183E8D /* SBTemplateRegistration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBTemplateRegistration.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBTemplateRegistration.m; sourceTree = "<group>"; };
848CB73E16FCC8C100183E8D /* SBStoredRegistrationEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBStoredRegistrationEntry.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBStoredRegistrationEntry.h; sourceTree = "<group>"; };
848CB73F16FCC8C100183E8D /* SBStoredRegistrationEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBStoredRegistrationEntry.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBStoredRegistrationEntry.m; sourceTree = "<group>"; };
924E069B185BC3C50078E879 /* SBStaticHandlerResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBStaticHandlerResponse.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBStaticHandlerResponse.h; sourceTree = "<group>"; };
924E069C185BC3C50078E879 /* SBStaticHandlerResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBStaticHandlerResponse.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBStaticHandlerResponse.m; sourceTree = "<group>"; };
A3C2060016B9FC0B00158A35 /* SBConnectionString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBConnectionString.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBConnectionString.h; sourceTree = "<group>"; };
A3C2060116B9FC0B00158A35 /* SBConnectionString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBConnectionString.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBConnectionString.m; sourceTree = "<group>"; };
A3C2060216B9FC0B00158A35 /* SBNotificationHub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBNotificationHub.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBNotificationHub.h; sourceTree = "<group>"; };
A3C2060316B9FC0B00158A35 /* SBNotificationHub.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBNotificationHub.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBNotificationHub.m; sourceTree = "<group>"; };
A3C2060616B9FC0B00158A35 /* SBRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBRegistration.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBRegistration.h; sourceTree = "<group>"; };
A3C2060716B9FC0B00158A35 /* SBRegistration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBRegistration.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/SBRegistration.m; sourceTree = "<group>"; };
A3C2060C16B9FC1900158A35 /* SBNotificationHubHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBNotificationHubHelper.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBNotificationHubHelper.h; sourceTree = "<group>"; };
A3C2060D16B9FC1900158A35 /* SBNotificationHubHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBNotificationHubHelper.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBNotificationHubHelper.m; sourceTree = "<group>"; };
A3C2060E16B9FC1900158A35 /* SBRegistrationParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBRegistrationParser.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBRegistrationParser.h; sourceTree = "<group>"; };
A3C2060F16B9FC1900158A35 /* SBRegistrationParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBRegistrationParser.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBRegistrationParser.m; sourceTree = "<group>"; };
A3C2061016B9FC1900158A35 /* SBTokenProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTokenProvider.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBTokenProvider.h; sourceTree = "<group>"; };
A3C2061116B9FC1900158A35 /* SBTokenProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBTokenProvider.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBTokenProvider.m; sourceTree = "<group>"; };
A3C2061216B9FC1900158A35 /* SBURLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBURLConnection.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBURLConnection.h; sourceTree = "<group>"; };
A3C2061316B9FC1900158A35 /* SBURLConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBURLConnection.m; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBURLConnection.m; sourceTree = "<group>"; };
A3C2061816B9FC2F00158A35 /* WindowsAzureMessaging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WindowsAzureMessaging.h; path = ../../WindowsAzureMessaging/WindowsAzureMessaging/WindowsAzureMessaging.h; sourceTree = "<group>"; };
A3C2064416BC3F3300158A35 /* TestHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestHelper.h; path = ../TestHelper.h; sourceTree = "<group>"; };
A3C2064516BC3F3300158A35 /* TestHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestHelper.m; path = ../TestHelper.m; sourceTree = "<group>"; };
A3C669AA16A8DB4300CEA9F3 /* WindowsAzureMessagingTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WindowsAzureMessagingTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
A3C669AE16A8DB4300CEA9F3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
A3C669B016A8DB4300CEA9F3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A3C669B216A8DB4300CEA9F3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
A3C669B616A8DB4300CEA9F3 /* WindowsAzureMessagingTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WindowsAzureMessagingTest-Info.plist"; sourceTree = "<group>"; };
A3C669B816A8DB4300CEA9F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A3C669BA16A8DB4300CEA9F3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
A3C669BC16A8DB4300CEA9F3 /* WindowsAzureMessagingTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WindowsAzureMessagingTest-Prefix.pch"; sourceTree = "<group>"; };
A3C669BD16A8DB4300CEA9F3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
A3C669BE16A8DB4300CEA9F3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
A3C669C016A8DB4300CEA9F3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
A3C669C116A8DB4300CEA9F3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
A3C669C416A8DB4300CEA9F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; };
A3C669C716A8DB4300CEA9F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
A3C669CE16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WindowsAzureMessagingTestTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
A3C669CF16A8DB4300CEA9F3 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
A3C669D716A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WindowsAzureMessagingTestTests-Info.plist"; sourceTree = "<group>"; };
A3C669D916A8DB4300CEA9F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A3C669DB16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowsAzureMessagingTestTests.h; sourceTree = "<group>"; };
A3C669DC16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WindowsAzureMessagingTestTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A3C669A716A8DB4300CEA9F3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669AF16A8DB4300CEA9F3 /* UIKit.framework in Frameworks */,
A3C669B116A8DB4300CEA9F3 /* Foundation.framework in Frameworks */,
A3C669B316A8DB4300CEA9F3 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A3C669CA16A8DB4300CEA9F3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669D016A8DB4300CEA9F3 /* SenTestingKit.framework in Frameworks */,
A3C669D116A8DB4300CEA9F3 /* UIKit.framework in Frameworks */,
A3C669D216A8DB4300CEA9F3 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
A3C205FF16B9FBF000158A35 /* SrcReference */ = {
isa = PBXGroup;
children = (
924E069B185BC3C50078E879 /* SBStaticHandlerResponse.h */,
924E069C185BC3C50078E879 /* SBStaticHandlerResponse.m */,
848CB73E16FCC8C100183E8D /* SBStoredRegistrationEntry.h */,
848CB73F16FCC8C100183E8D /* SBStoredRegistrationEntry.m */,
848CB70C16FBE68700183E8D /* SBTemplateRegistration.h */,
848CB70D16FBE68700183E8D /* SBTemplateRegistration.m */,
8471C92D16F3DED000C73674 /* SBLocalStorage.h */,
8471C92E16F3DED000C73674 /* SBLocalStorage.m */,
A3C2061816B9FC2F00158A35 /* WindowsAzureMessaging.h */,
A3C2060C16B9FC1900158A35 /* SBNotificationHubHelper.h */,
A3C2060D16B9FC1900158A35 /* SBNotificationHubHelper.m */,
A3C2060E16B9FC1900158A35 /* SBRegistrationParser.h */,
A3C2060F16B9FC1900158A35 /* SBRegistrationParser.m */,
A3C2061016B9FC1900158A35 /* SBTokenProvider.h */,
A3C2061116B9FC1900158A35 /* SBTokenProvider.m */,
A3C2061216B9FC1900158A35 /* SBURLConnection.h */,
A3C2061316B9FC1900158A35 /* SBURLConnection.m */,
A3C2060016B9FC0B00158A35 /* SBConnectionString.h */,
A3C2060116B9FC0B00158A35 /* SBConnectionString.m */,
A3C2060216B9FC0B00158A35 /* SBNotificationHub.h */,
A3C2060316B9FC0B00158A35 /* SBNotificationHub.m */,
A3C2060616B9FC0B00158A35 /* SBRegistration.h */,
A3C2060716B9FC0B00158A35 /* SBRegistration.m */,
);
name = SrcReference;
path = ../WindowsAzureMessagingTest;
sourceTree = "<group>";
};
A3C6699F16A8DB4300CEA9F3 = {
isa = PBXGroup;
children = (
A3C669B416A8DB4300CEA9F3 /* WindowsAzureMessagingTest */,
A3C669D516A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests */,
A3C669AD16A8DB4300CEA9F3 /* Frameworks */,
A3C669AB16A8DB4300CEA9F3 /* Products */,
);
sourceTree = "<group>";
};
A3C669AB16A8DB4300CEA9F3 /* Products */ = {
isa = PBXGroup;
children = (
A3C669AA16A8DB4300CEA9F3 /* WindowsAzureMessagingTest.app */,
A3C669CE16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.octest */,
);
name = Products;
sourceTree = "<group>";
};
A3C669AD16A8DB4300CEA9F3 /* Frameworks */ = {
isa = PBXGroup;
children = (
A3C669AE16A8DB4300CEA9F3 /* UIKit.framework */,
A3C669B016A8DB4300CEA9F3 /* Foundation.framework */,
A3C669B216A8DB4300CEA9F3 /* CoreGraphics.framework */,
A3C669CF16A8DB4300CEA9F3 /* SenTestingKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
A3C669B416A8DB4300CEA9F3 /* WindowsAzureMessagingTest */ = {
isa = PBXGroup;
children = (
A3C669BD16A8DB4300CEA9F3 /* AppDelegate.h */,
A3C669BE16A8DB4300CEA9F3 /* AppDelegate.m */,
A3C669C016A8DB4300CEA9F3 /* ViewController.h */,
A3C669C116A8DB4300CEA9F3 /* ViewController.m */,
A3C669C316A8DB4300CEA9F3 /* ViewController_iPhone.xib */,
A3C669C616A8DB4300CEA9F3 /* ViewController_iPad.xib */,
A3C669B516A8DB4300CEA9F3 /* Supporting Files */,
);
path = WindowsAzureMessagingTest;
sourceTree = "<group>";
};
A3C669B516A8DB4300CEA9F3 /* Supporting Files */ = {
isa = PBXGroup;
children = (
A3C669B616A8DB4300CEA9F3 /* WindowsAzureMessagingTest-Info.plist */,
A3C669B716A8DB4300CEA9F3 /* InfoPlist.strings */,
A3C669BA16A8DB4300CEA9F3 /* main.m */,
A3C669BC16A8DB4300CEA9F3 /* WindowsAzureMessagingTest-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
A3C669D516A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests */ = {
isa = PBXGroup;
children = (
A3C205FF16B9FBF000158A35 /* SrcReference */,
A3C669DB16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.h */,
A3C669DC16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.m */,
A3C2064416BC3F3300158A35 /* TestHelper.h */,
A3C2064516BC3F3300158A35 /* TestHelper.m */,
A3C669D616A8DB4300CEA9F3 /* Supporting Files */,
);
path = WindowsAzureMessagingTestTests;
sourceTree = "<group>";
};
A3C669D616A8DB4300CEA9F3 /* Supporting Files */ = {
isa = PBXGroup;
children = (
A3C669D716A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests-Info.plist */,
A3C669D816A8DB4300CEA9F3 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A3C669A916A8DB4300CEA9F3 /* WindowsAzureMessagingTest */ = {
isa = PBXNativeTarget;
buildConfigurationList = A3C669E016A8DB4300CEA9F3 /* Build configuration list for PBXNativeTarget "WindowsAzureMessagingTest" */;
buildPhases = (
A3C669A616A8DB4300CEA9F3 /* Sources */,
A3C669A716A8DB4300CEA9F3 /* Frameworks */,
A3C669A816A8DB4300CEA9F3 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = WindowsAzureMessagingTest;
productName = WindowsAzureMessagingTest;
productReference = A3C669AA16A8DB4300CEA9F3 /* WindowsAzureMessagingTest.app */;
productType = "com.apple.product-type.application";
};
A3C669CD16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = A3C669E316A8DB4300CEA9F3 /* Build configuration list for PBXNativeTarget "WindowsAzureMessagingTestTests" */;
buildPhases = (
A3C669C916A8DB4300CEA9F3 /* Sources */,
A3C669CA16A8DB4300CEA9F3 /* Frameworks */,
A3C669CB16A8DB4300CEA9F3 /* Resources */,
A3C669CC16A8DB4300CEA9F3 /* ShellScript */,
);
buildRules = (
);
dependencies = (
A3C669D416A8DB4300CEA9F3 /* PBXTargetDependency */,
);
name = WindowsAzureMessagingTestTests;
productName = WindowsAzureMessagingTestTests;
productReference = A3C669CE16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.octest */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
A3C669A116A8DB4300CEA9F3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
ORGANIZATIONNAME = "Azure ServiceBus";
};
buildConfigurationList = A3C669A416A8DB4300CEA9F3 /* Build configuration list for PBXProject "WindowsAzureMessagingTest" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = A3C6699F16A8DB4300CEA9F3;
productRefGroup = A3C669AB16A8DB4300CEA9F3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
A3C669A916A8DB4300CEA9F3 /* WindowsAzureMessagingTest */,
A3C669CD16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
A3C669A816A8DB4300CEA9F3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669B916A8DB4300CEA9F3 /* InfoPlist.strings in Resources */,
A3C669C516A8DB4300CEA9F3 /* ViewController_iPhone.xib in Resources */,
A3C669C816A8DB4300CEA9F3 /* ViewController_iPad.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A3C669CB16A8DB4300CEA9F3 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669DA16A8DB4300CEA9F3 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
A3C669CC16A8DB4300CEA9F3 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A3C669A616A8DB4300CEA9F3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669BB16A8DB4300CEA9F3 /* main.m in Sources */,
A3C669BF16A8DB4300CEA9F3 /* AppDelegate.m in Sources */,
A3C669C216A8DB4300CEA9F3 /* ViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A3C669C916A8DB4300CEA9F3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A3C669DD16A8DB4300CEA9F3 /* WindowsAzureMessagingTestTests.m in Sources */,
A3C2060816B9FC0B00158A35 /* SBConnectionString.m in Sources */,
A3C2060916B9FC0B00158A35 /* SBNotificationHub.m in Sources */,
A3C2060B16B9FC0B00158A35 /* SBRegistration.m in Sources */,
A3C2061416B9FC1900158A35 /* SBNotificationHubHelper.m in Sources */,
A3C2061516B9FC1900158A35 /* SBRegistrationParser.m in Sources */,
A3C2061616B9FC1900158A35 /* SBTokenProvider.m in Sources */,
A3C2061716B9FC1900158A35 /* SBURLConnection.m in Sources */,
A3C2064616BC3F3300158A35 /* TestHelper.m in Sources */,
8471C92F16F3DED000C73674 /* SBLocalStorage.m in Sources */,
848CB70E16FBE68700183E8D /* SBTemplateRegistration.m in Sources */,
848CB74016FCC8C100183E8D /* SBStoredRegistrationEntry.m in Sources */,
924E069D185BC3C50078E879 /* SBStaticHandlerResponse.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
A3C669D416A8DB4300CEA9F3 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = A3C669A916A8DB4300CEA9F3 /* WindowsAzureMessagingTest */;
targetProxy = A3C669D316A8DB4300CEA9F3 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
A3C669B716A8DB4300CEA9F3 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
A3C669B816A8DB4300CEA9F3 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
A3C669C316A8DB4300CEA9F3 /* ViewController_iPhone.xib */ = {
isa = PBXVariantGroup;
children = (
A3C669C416A8DB4300CEA9F3 /* en */,
);
name = ViewController_iPhone.xib;
sourceTree = "<group>";
};
A3C669C616A8DB4300CEA9F3 /* ViewController_iPad.xib */ = {
isa = PBXVariantGroup;
children = (
A3C669C716A8DB4300CEA9F3 /* en */,
);
name = ViewController_iPad.xib;
sourceTree = "<group>";
};
A3C669D816A8DB4300CEA9F3 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
A3C669D916A8DB4300CEA9F3 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
A3C669DE16A8DB4300CEA9F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_AFTER_BUILD = NO;
};
name = Debug;
};
A3C669DF16A8DB4300CEA9F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_AFTER_BUILD = NO;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
A3C669E116A8DB4300CEA9F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Prefix.pch";
INFOPLIST_FILE = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_AFTER_BUILD = NO;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
A3C669E216A8DB4300CEA9F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Prefix.pch";
INFOPLIST_FILE = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_AFTER_BUILD = NO;
WRAPPER_EXTENSION = app;
};
name = Release;
};
A3C669E416A8DB4300CEA9F3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/WindowsAzureMessagingTest.app/WindowsAzureMessagingTest";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"\"$(SRCROOT)\"",
"\"$(SRCROOT)/..\"",
"\"$(SRCROOT)/../Output/WindowsAzureMessaging-cbpndrltgohoaacmvxivevylenkf/Build/Products/Debug-iphonesimulator\"",
"\"$(SRCROOT)/../WindowsAzureMessaging/build/Release-iphonesimulator\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Prefix.pch";
INFOPLIST_FILE = "WindowsAzureMessagingTestTests/WindowsAzureMessagingTestTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_AFTER_BUILD = NO;
TEST_HOST = "";
WRAPPER_EXTENSION = octest;
};
name = Debug;
};
A3C669E516A8DB4300CEA9F3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/WindowsAzureMessagingTest.app/WindowsAzureMessagingTest";
FRAMEWORK_SEARCH_PATHS = (
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"\"$(SRCROOT)\"",
"\"$(SRCROOT)/..\"",
"\"$(SRCROOT)/../Output/WindowsAzureMessaging-cbpndrltgohoaacmvxivevylenkf/Build/Products/Debug-iphonesimulator\"",
"\"$(SRCROOT)/../WindowsAzureMessaging/build/Release-iphonesimulator\"",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WindowsAzureMessagingTest/WindowsAzureMessagingTest-Prefix.pch";
INFOPLIST_FILE = "WindowsAzureMessagingTestTests/WindowsAzureMessagingTestTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_AFTER_BUILD = NO;
TEST_HOST = "";
WRAPPER_EXTENSION = octest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A3C669A416A8DB4300CEA9F3 /* Build configuration list for PBXProject "WindowsAzureMessagingTest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A3C669DE16A8DB4300CEA9F3 /* Debug */,
A3C669DF16A8DB4300CEA9F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A3C669E016A8DB4300CEA9F3 /* Build configuration list for PBXNativeTarget "WindowsAzureMessagingTest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A3C669E116A8DB4300CEA9F3 /* Debug */,
A3C669E216A8DB4300CEA9F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A3C669E316A8DB4300CEA9F3 /* Build configuration list for PBXNativeTarget "WindowsAzureMessagingTestTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A3C669E416A8DB4300CEA9F3 /* Debug */,
A3C669E516A8DB4300CEA9F3 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = A3C669A116A8DB4300CEA9F3 /* Project object */;
}

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

@ -0,0 +1,19 @@
//
// AppDelegate.h
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@end

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

@ -0,0 +1,56 @@
//
// AppDelegate.m
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
} else {
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

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

@ -0,0 +1,13 @@
//
// ViewController.h
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

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

@ -0,0 +1,38 @@
//
// ViewController.m
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
@end

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

@ -0,0 +1,45 @@
<?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>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.microsoft.svcbusblue</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

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

@ -0,0 +1,14 @@
//
// Prefix header for all source files of the 'WindowsAzureMessagingTest' target in the 'WindowsAzureMessagingTest' project
//
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

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

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

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

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11C25</string>
<string key="IBDocument.InterfaceBuilderVersion">1919</string>
<string key="IBDocument.AppKitVersion">1138.11</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">916</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="606714003">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIView" id="766721923">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 20}, {768, 1004}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="766721923"/>
</object>
<int key="connectionID">3</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="606714003"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="766721923"/>
<reference key="parent" ref="0"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">ViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">3</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ViewController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">916</string>
</data>
</archive>

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

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11C25</string>
<string key="IBDocument.InterfaceBuilderVersion">1919</string>
<string key="IBDocument.AppKitVersion">1138.11</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">916</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="843779117">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="774585933"/>
</object>
<int key="connectionID">7</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="843779117"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="774585933"/>
<reference key="parent" ref="0"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">ViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ViewController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">916</string>
</data>
</archive>

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

@ -0,0 +1,18 @@
//
// main.m
// WindowsAzureMessagingTest
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

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

@ -0,0 +1,22 @@
<?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>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.microsoft.svcbusblue</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

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

@ -0,0 +1,13 @@
//
// WindowsAzureMessagingTestTests.h
// WindowsAzureMessagingTestTests
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface WindowsAzureMessagingTestTests : SenTestCase
@end

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

@ -0,0 +1,771 @@
//
// WindowsAzureMessagingTestTests.m
// WindowsAzureMessagingTestTests
//
// Created by Vinod Shanbhag on 1/17/13.
// Copyright (c) 2013 Azure ServiceBus. All rights reserved.
//
#import "WindowsAzureMessagingTestTests.h"
#import "WindowsAzureMessaging.h"
#import "SBURLConnection.h"
#import "TestHelper.h"
#import "SBLocalStorage.h"
@implementation WindowsAzureMessagingTestTests
NSString* path = @"PushTest";
NSString *connectionStringSAS;
NSString *connectionStringACS;
BOOL httpRequestFinished;
BOOL tokenRequestFinished;
BOOL refreshRequestFinished;
BOOL createRegistrationIdRequestFinished;
NSString* emptyRegistrations = @"<feed xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\">Registrations</title><id>https://testuser2-int7sn1007-1-8e72f-36.servicebus.int7.windows-int.net/CreateWindowsRegistrationWithDifferentLocalStorageVersion-NotificationHub-rL9GkO/Registrations/?$filter=channelUri%20eq%20'https%3A%2F%2Ftest.notify.windows.com%2F%3Ftoken%3DrFEXKubeJZrLYYtgIx5OFH62nimatX1U'&amp;api-version=2013-04</id><updated>2013-06-06T17:12:27Z</updated><link rel=\"self\" href=\"https://testuser2-int7sn1007-1-8e72f-36.servicebus.int7.windows-int.net/CreateWindowsRegistrationWithDifferentLocalStorageVersion-NotificationHub-rL9GkO/Registrations/?$filter=channelUri%20eq%20'https%3A%2F%2Ftest.notify.windows.com%2F%3Ftoken%3DrFEXKubeJZrLYYtgIx5OFH62nimatX1U'&amp;api-version=2013-04\"/></feed>";
NSString* deviceToken1 = @"11";
NSString* deviceToken2 = @"22";
- (void)setUp
{
[super setUp];
connectionStringSAS = [SBConnectionString stringWithEndpoint:[NSURL URLWithString:@"https://test.servicebus.windows.net/"] fullAccessSecret:@"myFullAccessPwd"];
connectionStringACS = [SBConnectionString stringWithEndpoint:[NSURL URLWithString:@"sb://test.servicebus.windows.net"] issuer:@"owner" issuerSecret:@"GnxQQPqX2xwy72BE2Kmb/RvD58R1p7/NqVL9v8bmqC0="];
}
- (void)tearDown
{
// Tear-down code here.
[super tearDown];
}
- (void)testConnectionString
{
NSString* conn = [SBConnectionString stringWithEndpoint:[NSURL URLWithString:@"sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/"] fullAccessSecret:@"myFullAccessPwd"];
if(![conn isEqualToString:@"Endpoint=sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=myFullAccessPwd"])
{
STFail(@"Fail at connectionString for full accessSecret.");
return;
}
conn = [SBConnectionString stringWithEndpoint:[NSURL URLWithString:@"sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/"] listenAccessSecret:@"myListenAccessPwd"];
if(![conn isEqualToString:@"Endpoint=sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=myListenAccessPwd"])
{
STFail(@"Fail at connectionString for listen accessSecret.");
return;
}
conn = [SBConnectionString stringWithEndpoint:[NSURL URLWithString:@"sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/"] issuer:@"owner" issuerSecret:@"GnxQQPqX2xwy72BE2Kmb/RvD58R1p7/NqVL9v8bmqC0="];
if(![conn isEqualToString:@"Endpoint=sb://INT7-SN1-012Tinnu-0-10.servicebus.int7.windows-int.net/;SharedSecretIssuer=owner;SharedSecretValue=GnxQQPqX2xwy72BE2Kmb/RvD58R1p7/NqVL9v8bmqC0="])
{
STFail(@"Fail at connectionString for full sharedScrete.");
return;
}
}
- (void)testInvalidConnectionString
{
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:@"wrongConnectionString" notificationHubPath:path];
if(notificationHub)
{
STFail(@"Fail at creating notificationHub.");
return;
}
}
- (void)testCreateRegistrationWithSameStorageVersion
{
[TestHelper updateSettingWithVersion:TRUE registrations:FALSE useOldVersion:FALSE];
NSLog(@"1: creat notifiationHub");
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
if(!notificationHub)
{
STFail(@"Fail at creating notificationHub.");
return;
}
NSData* deviceToken = [deviceToken1 dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"2. registerNative");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if (!createRegistrationIdRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"POST" url:@"https://test.servicebus.windows.net/PushTest/registrationids/?api-version=2013-04" body:@""];
if(ret)
{
NSLog(@"Second call should be create registraionId call.");
STFail(ret);
}
createRegistrationIdRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
response.Headers = @{@"Location":@"https://test.servicebus.windows.net/PushTest/registrations/73838-337-2383"};
return response;
}
else
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"PUT" url:@"https://test.servicebus.windows.net/PushTest/Registrations/73838-337-2383?api-version=2013-04" body:@"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"><Tags>Tag2,Tag1</Tags><DeviceToken>3131</DeviceToken></AppleRegistrationDescription></content></entry>"];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
// creat regs
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] error:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] completion:nil];
sleep(1);
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"3. registerTemplate");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if (!createRegistrationIdRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"POST" url:@"https://test.servicebus.windows.net/PushTest/registrationids/?api-version=2013-04" body:@""];
if(ret)
{
NSLog(@"Second call should be create registraionId call.");
STFail(ret);
}
createRegistrationIdRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
response.Headers = @{@"Location":@"https://test.servicebus.windows.net/PushTest/registrations/73838-337-2383"};
return response;
}
else
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"PUT" url:@"https://test.servicebus.windows.net/PushTest/Registrations/73838-337-2383?api-version=2013-04" body:@"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleTemplateRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"><Tags>tag3,tag4</Tags><DeviceToken>3131</DeviceToken><BodyTemplate><![CDATA[{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}]]></BodyTemplate><Expiry>$(expiry)</Expiry><TemplateName>MyReg2</TemplateName></AppleTemplateRegistrationDescription></content></entry>"];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] error:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] completion:nil];
sleep(1);
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
[SBURLConnection setStaticHandler:nil];
}
}
- (void)testCreateRegistrationWithSameStorageVersionAndRegistrationCache
{
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:FALSE];
NSLog(@"1: creat notifiationHub");
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
if(!notificationHub)
{
STFail(@"Fail at creating notificationHub.");
return;
}
NSData* deviceToken = [deviceToken1 dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"2. registerNative");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"PUT" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId1?api-version=2013-04" body:@"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"><Tags>Tag2,Tag1</Tags><DeviceToken>3131</DeviceToken></AppleRegistrationDescription></content></entry>"];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}];
// creat regs
httpRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] error:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] completion:nil];
sleep(1);
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"3. registerTemplate");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"PUT" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId2?api-version=2013-04" body:@"<entry xmlns=\"http://www.w3.org/2005/Atom\"><content type=\"text/xml\"><AppleTemplateRegistrationDescription xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.microsoft.com/netservices/2010/10/servicebus/connect\"><Tags>tag3,tag4</Tags><DeviceToken>3131</DeviceToken><BodyTemplate><![CDATA[{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}]]></BodyTemplate><Expiry>$(expiry)</Expiry><TemplateName>regName</TemplateName></AppleTemplateRegistrationDescription></content></entry>"];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
httpRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"regName" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] error:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"regName" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] completion:nil];
sleep(1);
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
[SBURLConnection setStaticHandler:nil];
}
}
- (void)testCreateRegistrationWithEmptyStorageVersion
{
// when ther version is not in the local setting, or different
// All create calls should start with retrieveAll call
NSData* deviceToken = [deviceToken1 dataUsingEncoding:NSUTF8StringEncoding];
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if( !refreshRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"GET" url:@"https://test.servicebus.windows.net/PushTest/Registrations/?$filter=deviceToken+eq+'3131'&api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
refreshRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [emptyRegistrations dataUsingEncoding:NSUTF8StringEncoding];
return response;
}
else if (refreshRequestFinished && !createRegistrationIdRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"POST" url:@"https://test.servicebus.windows.net/PushTest/registrationids/?api-version=2013-04" body:@""];
if(ret)
{
NSLog(@"Second call should be create registraionId call.");
STFail(ret);
}
createRegistrationIdRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
response.Headers = @{@"Location":@"https://test.servicebus.windows.net/PushTest/registrations/73838-337-2383"};
return response;
}
else
{
//second call should be create
if(![[request HTTPMethod] isEqualToString:@"PUT"])
{
STFail(@"Last call should be create call.");
}
// same deviceToken
NSString* body = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];
if ([body rangeOfString:@"<DeviceToken>3131</DeviceToken>"].location == NSNotFound)
{
STFail(@"Second call body should include correct deviceToken.");
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
NSLog(@"1. registerNative");
{
// create regs
[TestHelper updateSettingWithVersion:FALSE registrations:FALSE useOldVersion:FALSE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] error:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"2. registerNative async");
{
[TestHelper updateSettingWithVersion:FALSE registrations:FALSE useOldVersion:FALSE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] completion:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"3. registerTemplate");
{
// template
[TestHelper updateSettingWithVersion:FALSE registrations:FALSE useOldVersion:FALSE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] error:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"4. registerTemplate async");
{
[TestHelper updateSettingWithVersion:FALSE registrations:FALSE useOldVersion:FALSE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] completion:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
[SBURLConnection setStaticHandler:nil];
}
- (void)testCreateRegistrationWithDifferentStorageVersionAndNewDeviceToken
{
// when ther version is not in the local setting, or different
// All create calls should start with retrieveAll call
NSData* deviceToken = [deviceToken2 dataUsingEncoding:NSUTF8StringEncoding];
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if( !refreshRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"GET" url:@"https://test.servicebus.windows.net/PushTest/Registrations/?$filter=deviceToken+eq+'3131'&api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
refreshRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [emptyRegistrations dataUsingEncoding:NSUTF8StringEncoding];
return response;
}
else if (refreshRequestFinished && !createRegistrationIdRequestFinished)
{
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"POST" url:@"https://test.servicebus.windows.net/PushTest/registrationids/?api-version=2013-04" body:@""];
if(ret)
{
NSLog(@"Second call should be create registraionId call.");
STFail(ret);
}
createRegistrationIdRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
response.Headers = @{@"Location":@"https://test.servicebus.windows.net/PushTest/registrations/73838-337-2383"};
return response;
}
else
{
//second call should be create
NSString* method = [request HTTPMethod];
if(![method isEqualToString:@"PUT"])
{
STFail(@"Second call should be create call.");
}
// new deviceToken
NSString* body = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];
if ([body rangeOfString:@"<DeviceToken>3232</DeviceToken>"].location == NSNotFound)
{
STFail(@"Second call body should include correct deviceToken.");
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
NSLog(@"1. registerNative");
{
// create regs
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:TRUE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] error:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"2. registerNative async");
{
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:TRUE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerNativeWithDeviceToken:deviceToken tags:[NSSet setWithArray:@[@"Tag1",@"Tag2"]] completion:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"3. registerTemplate");
{
// template
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:TRUE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] error:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
NSLog(@"4. registerTemplate async");
{
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:TRUE];
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
NSString* jsonBody = @"{\"aps\":{\"alert\":\"$(GotMail)\",\"badge\":10, \"sound\":\"bingbong.aiff\"},\"acme\":\"My data\"}";
createRegistrationIdRequestFinished = FALSE;
httpRequestFinished = FALSE;
refreshRequestFinished = FALSE;
[notificationHub registerTemplateWithDeviceToken:deviceToken name:@"MyReg2" jsonBodyTemplate:jsonBody expiryTemplate:@"$(expiry)" tags:[NSSet setWithArray:@[@"tag3",@"tag4"]] completion:nil];
if(!httpRequestFinished || !refreshRequestFinished)
{
STFail(@"Http request didn't send out.");
}
}
[SBURLConnection setStaticHandler:nil];
}
- (void)testDeleteRegistration
{
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:FALSE];
NSLog(@"1: creat notifiationHub");
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringSAS notificationHubPath:path];
if(!notificationHub)
{
STFail(@"Fail at creating notificationHub.");
return;
}
//NSData* deviceToken = [@"12345678912345678912345678912345" dataUsingEncoding:NSUTF8StringEncoding];
NSLog(@"3. unregisterNative");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"DELETE" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId1?api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}];
httpRequestFinished = FALSE;
[notificationHub unregisterNativeWithError:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub unregisterNativeWithCompletion:nil];
if(httpRequestFinished)
{
STFail(@"HTTP requests was sent out");
}
[SBURLConnection setStaticHandler:nil];
}
NSLog(@"4. unregisterTemplate");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
NSString* ret = [TestHelper verifySASHttpRequest:request httpMethod:@"DELETE" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId2?api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}];
httpRequestFinished = FALSE;
[notificationHub unregisterTemplateWithName:@"regName" error:nil];
if(!httpRequestFinished)
{
STFail(@"Http request didn't send out.");
}
httpRequestFinished = FALSE;
[notificationHub unregisterTemplateWithName:@"regName" completion:nil];
sleep(1);
if(httpRequestFinished)
{
STFail(@"HTTP requests was sent out");
}
httpRequestFinished = FALSE;
[notificationHub unregisterTemplateWithName:@"NoExistingName" completion:nil];
sleep(1);
if(httpRequestFinished)
{
STFail(@"Http request should not sent");
}
[SBURLConnection setStaticHandler:nil];
}
}
- (void)testDeleteRegistrationACS
{
[TestHelper updateSettingWithVersion:TRUE registrations:TRUE useOldVersion:FALSE];
NSLog(@"1: creat notifiationHub");
SBNotificationHub* notificationHub = [[SBNotificationHub alloc] initWithConnectionString:connectionStringACS notificationHubPath:path];
NSLog(@"3. unregisterDefault");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if( !tokenRequestFinished)
{
NSString* ret = [TestHelper verifyHttpRequest:request httpMethod:@"POST" url:@"https://test-sb.accesscontrol.windows.net/WRAPv0.9/" body:@"wrap_scope=http%3A%2F%2Ftest.servicebus.windows.net%2Fpushtest%2Fregistrations%2Fmyregid1&wrap_assertion_format=SWT&wrap_assertion=Issuer%3Downer%26HMACSHA256%3Dje1Q5mR%252FmLmbz%252Bio5k%252FuuJ8l4CM5EIb9uN73iZfCHgk%253D"];
if(ret)
{
STFail(ret);
}
tokenRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [@"wrap_access_token=newToken&wrap_acess_token_expires_in=3600" dataUsingEncoding:NSUTF8StringEncoding];
return response;
}
else
{
NSString* ret = [TestHelper verifyACSHttpRequest:request httpMethod:@"DELETE" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId1?api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
tokenRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub unregisterNativeWithError:nil];
if(!httpRequestFinished || !tokenRequestFinished)
{
STFail(@"Http request didn't send out.");
}
tokenRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub unregisterNativeWithCompletion:nil];
sleep(1);
if(httpRequestFinished || tokenRequestFinished)
{
STFail(@"HTTP requests was sent out");
}
[SBURLConnection setStaticHandler:nil];
}
NSLog(@"4. unregisterTemplate");
{
[SBURLConnection setStaticHandler:^SBStaticHandlerResponse *(NSURLRequest *request) {
if( !tokenRequestFinished)
{
NSString* ret = [TestHelper verifyHttpRequest:request httpMethod:@"POST" url:@"https://test-sb.accesscontrol.windows.net/WRAPv0.9/" body:@"wrap_scope=http%3A%2F%2Ftest.servicebus.windows.net%2Fpushtest%2Fregistrations%2Fmyregid2&wrap_assertion_format=SWT&wrap_assertion=Issuer%3Downer%26HMACSHA256%3Dje1Q5mR%252FmLmbz%252Bio5k%252FuuJ8l4CM5EIb9uN73iZfCHgk%253D"];
if(ret)
{
STFail(ret);
}
tokenRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [@"wrap_access_token=newToken&wrap_acess_token_expires_in=3600" dataUsingEncoding:NSUTF8StringEncoding];
return response;
}
else
{
NSString* ret = [TestHelper verifyACSHttpRequest:request httpMethod:@"DELETE" url:@"https://test.servicebus.windows.net/PushTest/Registrations/myRegId2?api-version=2013-04" body:@""];
if(ret)
{
STFail(ret);
}
httpRequestFinished = TRUE;
SBStaticHandlerResponse* response = [SBStaticHandlerResponse alloc];
response.Data = [NSData alloc];
return response;
}
}];
tokenRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub unregisterTemplateWithName:@"regName" error:nil];
if(!httpRequestFinished || !tokenRequestFinished)
{
STFail(@"Http request didn't send out.");
}
tokenRequestFinished = FALSE;
httpRequestFinished = FALSE;
[notificationHub unregisterTemplateWithName:@"regName" completion:nil];
sleep(1);
if(httpRequestFinished || tokenRequestFinished)
{
STFail(@"HTTP requests was sent out");
}
[SBURLConnection setStaticHandler:nil];
}
}
@end

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

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */