Skip to content

Instantly share code, notes, and snippets.

Sitecore Mobile SDK ver. 1.0.0

Introduction

Sitecore Mobile SDK is a framework that is designed to help the developer produce iOS based applications that use and serve content that is managed by Sitecore. This should enable you to rapidly develop iPhone applications utilizing the full phone features (camera, location, accelerometer and gestures for example). The applications can then request content from Sitecore efficiently and securely.

Details on what is contained in the Sitecore package and the iOS project template and libraries can be found below.

The framework comes with a sample project that makes it very easy to start writing apps, along with comprehensive developer documentation, and several sample projects, including the iPhone/iPad application based on the Nicam demonstration site.

@dodikk
dodikk / DynamicLocalization.mm
Last active September 15, 2016 22:30
Dynamic localization for iOS
@implementation NSBundle( Dynamic )
-(NSString*)localizedStringForKey:(NSString*)key
value:(NSString*)value
table:(NSString*)table
locale:( NSLocale* )locale
{
// TODO : implement this category
NSString* shortLocaleId = [ locale shortLocaleIdentifier ];
@dodikk
dodikk / NSString_to_Stl.mm
Created November 6, 2013 14:48
Converts NSString to std::string
- (std::string)toStlString
{
if (nil == self)
{
return "";
}
NSUInteger bytesSize = [self lengthOfBytesUsingEncoding: NSUTF8StringEncoding] + sizeof( char );
std::vector<char> bytesVt( bytesSize, 0x00 );
@dodikk
dodikk / ObjectiveCpp.pch
Created November 7, 2013 09:36
Objective-C++ precompiled headers in a nutshell.
// *.pch
// Pure C headers go here
#include <math.h>
#ifdef __cplusplus
// Pure c++ headers ho here
#include <vector>
#endif
@dodikk
dodikk / SDSegmentedControlHelper.m
Created November 21, 2013 08:43
Support for reselecting segmented control. segmentedControl.momentary = YES;
#import "SDSegmentedControlHelper.h"
@implementation SDSegmentedControlHelper
+(void)selectTrafficSegmentInSegmentedControl:( UISegmentedControl* )sender
{
NSArray* segments = [ sender subviews ];
id trafficSegment = segments[1];
id campaignSegment = segments[0];
@dodikk
dodikk / locale-lldb-log.txt
Created November 25, 2013 10:04
Incorrect settings for russian calendars
(lldb) po date_
2010-12-27 00:00:00 +0000
(lldb) po result
W1 2011
(lldb) po [[formatter_ locale]localeIdentifier]
ru_RU
(lldb) po [ calendar_ calendarIdentifier ]
@dodikk
dodikk / Correct_x64.m
Created November 29, 2013 08:55
objc_msgSend() and literal constants on x64
const int64_t bytesWritten = 150;
const int64_t totalBytesWritten = 500;
const int64_t totalBytesExpectedToWrite = 3872;
SEL delegateMethod = @selector(URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:);
objc_msgSend
(
mockSessionDelegate, delegateMethod,
mockSession, mockTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite
@dodikk
dodikk / UrlSessionDelegate.m
Created November 29, 2013 16:59
Download to tmp file handling
-(void)URLSession:(NSURLSession *)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask
didFinishDownloadingToURL:(NSURL *)location
{
NSParameterAssert( nil != location );
if ( self->_shouldCopyTmpFileToCaches )
{
JFFAsyncOperation asyncCopy = [ [ self class ] asyncCopyFileToCaches: location ];
asyncCopy( nil, nil, ^void( NSURL* tmpFileInCaches, NSError* copyError )
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
@dodikk
dodikk / Includes-Objc.m
Created December 9, 2013 10:28
Correct Include style for objective-c
#import "LineReader.h" // required to conform protocol LineReader
#import <Foundation/Foundation.h> // required to inherit NSObject
#include "MyPureCStruct.h" // required to declare plainOldData
#include "MyBlockTypedefs.h" // required to include custom blocks
@class MyOtherClass; // do not use #import
@protocol MyOtherProtocol; // do not use #import
@interface WindowsLineReader : NSObject< LineReader >