Skip to content

Instantly share code, notes, and snippets.

View MobileSDK-README.md

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 Sep 15, 2016
Dynamic localization for iOS
View DynamicLocalization.mm
@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 Nov 6, 2013
Converts NSString to std::string
View NSString_to_Stl.mm
- (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 Nov 7, 2013
Objective-C++ precompiled headers in a nutshell.
View ObjectiveCpp.pch
// *.pch
// Pure C headers go here
#include <math.h>
#ifdef __cplusplus
// Pure c++ headers ho here
#include <vector>
#endif
@dodikk
dodikk / SDSegmentedControlHelper.m
Created Nov 21, 2013
Support for reselecting segmented control. segmentedControl.momentary = YES;
View SDSegmentedControlHelper.m
#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 Nov 25, 2013
Incorrect settings for russian calendars
View locale-lldb-log.txt
(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 Nov 29, 2013
objc_msgSend() and literal constants on x64
View Correct_x64.m
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 Nov 29, 2013
Download to tmp file handling
View UrlSessionDelegate.m
-(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 )
View gist:7746998
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
@dodikk
dodikk / Includes-Objc.m
Created Dec 9, 2013
Correct Include style for objective-c
View Includes-Objc.m
#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 >