1. m파일 내의 한글을 다음 함수로 감싼다. 

NSLocalizedString(@"어쩌구 저쩌구",nil)


2. 해당 파일 명을 넣어 다음 명령을 실행한다.

genstrings AppDelegate.m





신고
Posted by genius3k

애플 개발자 사이트에서 Production용 인증서 생성 후 다운로드 하여 Key Chain에 설치


애플 개발자 사이트에서 Production용 인증서와 Key Chain에서 개인키를 Export하여 저장


aps_production.cer <= 애플 개발자 사이트에서 다운로드 받은 푸쉬 배포용 인증서 파일

mykey.p12 <= 키체인에서 내보내기 한 개인키 파일


openssl x509 -in aps_production.cer -inform DER -out aps_production.pem -outform PEM

openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem

openssl pkcs12 -export -inkey mykey.pem -in aps_production.pem -out iphone_pro.p12



신고
Posted by genius3k

//

//  DESEncryptor.h

//  md5iOSTest

//

//  Created by kim kyung kuk on 14. 1. 20..

//  Copyright (c) 2014 __MyCompanyName__. All rights reserved.

//


#import <Foundation/Foundation.h>


@interface DESEncryptor : NSObject


+(NSString *) encrypt:(NSString *)str;

+(NSString *) decrypt:(NSString *)str;


@end



//

//  DESEncryptor.m

//  md5iOSTest

//

//  Created by kim kyung kuk on 14. 1. 20..

//  Copyright (c) 2014 __MyCompanyName__. All rights reserved.

//

#import "DESEncryptor.h"

#import <commoncrypto/commoncryptor.h>

#define ENCRYPT_KEY @"ab_booktv_abcd09"


@implementation DESEncryptor



//- 암호화

//1. 문자열 입력

//2. DES 암호화

//3. 암호화된 문자열을 base64 인코딩

+ (NSString *) encrypt:(NSString *)str

{

    //NSLog(@"encrypt input string : %@", str);

    //NSLog(@"input length : %d", [str length]);

    NSData *data = [str dataUsingEncoding: NSUTF8StringEncoding];

    //NSLog(@"data : %@", data);

    unsigned char *input = (unsigned char*)[data bytes];

    NSUInteger inLength = [data length];

    NSInteger outLength = ((inLength + kCCBlockSizeDES) & ~(kCCBlockSizeDES - 1));

    unsigned char *output =(unsigned char *)calloc(outLength, sizeof(unsigned char));

    bzero(output, outLength*sizeof(unsigned char));

    size_t additionalNeeded = 0;

    unsigned char *iv = (unsigned char *)calloc(kCCBlockSizeDES, sizeof(unsigned char));

    bzero(iv, kCCBlockSizeDES * sizeof(unsigned char));

    NSString *key = ENCRYPT_KEY;

    const void *vkey = (const void *) [key UTF8String];

    

    CCCryptorStatus err = CCCrypt(kCCEncrypt,

                                  kCCAlgorithmDES,

                                  kCCOptionPKCS7Padding | kCCOptionECBMode,

                                  vkey,

                                  kCCKeySizeDES,

                                  iv,

                                  input,

                                  inLength,

                                  output,

                                  outLength,

                                  &additionalNeeded);

    //NSLog(@"encrypt err: %d", err);

    if(0);

    else if (err == kCCParamError) NSLog(@"PARAM ERROR");

    else if (err == kCCBufferTooSmall) NSLog(@"BUFFER TOO SMALL");

    else if (err == kCCMemoryFailure) NSLog(@"MEMORY FAILURE");

    else if (err == kCCAlignmentError) NSLog(@"ALIGNMENT");

    else if (err == kCCDecodeError) NSLog(@"DECODE ERROR");

    else if (err == kCCUnimplemented) NSLog(@"UNIMPLEMENTED");

    free(iv);

    

    NSString *result;

    //NSData *myData = [NSData dataWithBytesNoCopy:output length:outLength freeWhenDone:YES];

    NSData *myData = [NSData dataWithBytesNoCopy:output length:(NSUInteger)additionalNeeded freeWhenDone:YES];

    //NSLog(@"data : %@", myData);

    //NSLog(@"encrypted string : %s", [myData bytes]);

    //NSLog(@"encrypted length : %d", [myData length]);

    result = [myData base64Encoding];

    

    //NSLog(@"base64encoded : %@", result);

    return result;

}


//- 복호화

//1. 암호화되고 base64 문자열 입력

//2. base64 UTF8 암호화만 되어있는 문자열로 디코딩

//3. 복호화

+ (NSString *) decrypt:(NSString *)str

{

    //NSLog(@"decrypt input string : %@", str);

    NSData *decodedData = [NSData dataWithBase64EncodedString:str];

    //NSLog(@"data : %@", decodedData);

    //NSLog(@"base64decoded : %s", [decodedData bytes]);

    unsigned char *input = (unsigned char*)[decodedData bytes];

    NSUInteger inLength = [decodedData length];

    NSInteger outLength = ((inLength + kCCBlockSizeDES) & ~(kCCBlockSizeDES - 1));

    unsigned char *output =(unsigned char *)calloc(outLength, sizeof(unsigned char));

    bzero(output, outLength*sizeof(unsigned char));

    size_t additionalNeeded = 0;

    unsigned char *iv = (unsigned char *)calloc(kCCBlockSizeDES, sizeof(unsigned char));

    bzero(iv, kCCBlockSizeDES * sizeof(unsigned char));

    NSString *key = ENCRYPT_KEY;

    const void *vkey = (const void *) [key UTF8String];

    

    CCCryptorStatus err = CCCrypt(kCCDecrypt,

                                  kCCAlgorithmDES,

                                  kCCOptionPKCS7Padding | kCCOptionECBMode,

                                  vkey,

                                  kCCKeySizeDES,

                                  iv,

                                  input,

                                  inLength,

                                  output,

                                  outLength,

                                  &additionalNeeded);

    //NSLog(@"encrypt err: %d", err);

    

    if(0);

    else if (err == kCCParamError) NSLog(@"PARAM ERROR");

    else if (err == kCCBufferTooSmall) NSLog(@"BUFFER TOO SMALL");

    else if (err == kCCMemoryFailure) NSLog(@"MEMORY FAILURE");

    else if (err == kCCAlignmentError) NSLog(@"ALIGNMENT");

    else if (err == kCCDecodeError) NSLog(@"DECODE ERROR");

    else if (err == kCCUnimplemented) NSLog(@"UNIMPLEMENTED");

    free(iv);

    

    NSString *result;

    //NSData *myData = [NSData dataWithBytes:(const void *)output length:(NSUInteger)additionalNeeded];

    //NSData *myData = [NSData dataWithBytesNoCopy:output length:outLength freeWhenDone:YES];

    NSData *myData = [NSData dataWithBytesNoCopy:output length:(NSUInteger)additionalNeeded freeWhenDone:YES];

    //NSLog(@"data : %@", myData);

    //NSLog(@"decrypted string : %s", [myData bytes]);

    //NSLog(@"decrypted length : %d", [myData length]);

    

    result = [NSString stringWithFormat:@"%.*s",[myData length], [myData bytes]];

    //result = [NSString stringWithUTF8String:[myData bytes]];

    //NSLog(@"output length : %d", [result length]);

    //NSLog(@"result : %@", result);

    

    return result;

}


@end



신고
Posted by genius3k

MD5 암호화 소스

IPhone 2014.01.20 14:50


- (NSString *) md5:(NSString *) input

{

    const char *cStr = [input UTF8String];

    unsigned char digest[16];

    CC_MD5( cStr, strlen(cStr), digest ); // This is the md5 call

    

    NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];

    

    for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)

        [output appendFormat:@"%02x", digest[i]];

    

    return  output;

    

}

신고
Posted by genius3k

http://mingu.kr/68
신고
Posted by genius3k

NSString *path = [NSString stringWithFormat:@"%@/Documents/", NSHomeDirectory()];

        localDataList = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];

        [localDataList retain];

신고
Posted by genius3k

PREFIX=/User/rain3k/compiled

ERRSTR="Usage: ./ios-configure.sh <simulator | device>"

if [[ $# != 1 ]]; then

    echo $ERRSTR

    exit

fi


if [[ "$1" == simulator ]]; then

    ARCH=i386

    DEVICE=Simulator

    HOST=i386

elif [[ "$1" == device ]]; then

    ARCH=armv7

    DEVICE=OS

    CFLAGS_FLAGS="-mcpu=cortex-a8 -marm"

    HOST=arm

else

    echo $ERRSTR

    exit

fi


DEVROOT=/Developer/Platforms/iPhone${DEVICE}.platform/Developer

SDKROOT=${DEVROOT}/SDKs/iPhone${DEVICE}4.3.sdk

export CFLAGS="-isysroot ${SDKROOT} ${CFLAGS_FLAGS}"

export LDFLAGS="-isysroot ${SDKROOT}"

./configure CC="${DEVROOT}/usr/bin/gcc -arch ${ARCH}" LD=$CC --host=${HOST}-apple-darwin

신고
Posted by genius3k

#!/bin/bash


ARCH=armv6

DEVICE=OS

HOST=arm

IOS_DEPLOY_TGT=3.2

IOS_BASE_SDK="4.2"

CFLAGS_FLAGS="-mcpu=cortex-a8 -marm"


DEVROOT=/Developer/Platforms/iPhone${DEVICE}.platform/Developer

SDKROOT=${DEVROOT}/SDKs/iPhone${DEVICE}4.3.sdk

export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"


export CFLAGS="$CFLAGS"

        export CPP="$DEVROOT/usr/bin/cpp-4.2"

        export CXX="$DEVROOT/usr/bin/g++-4.2"

        export CXXCPP="$DEVROOT/usr/bin/cpp-4.2"

        export CC="$DEVROOT/usr/bin/gcc-4.2"

        export LD=$DEVROOT/usr/bin/ld

        export AR=$DEVROOT/usr/bin/ar

        export AS=$DEVROOT/usr/bin/as

        export NM=$DEVROOT/usr/bin/nm

        export RANLIB=$DEVROOT/usr/bin/ranlib

        export LDFLAGS="-L$SDKROOT/usr/lib/"


        export CPPFLAGS=$CFLAGS

        export CXXFLAGS=$CFLAGS



./configure --host=arm-apple-darwin6

신고
Posted by genius3k
lipo -create Device용.a Simulator용.a -o 생성할파일명.a

이리 간단한 방법이 있었다니;;;;; 
신고
Posted by genius3k
To help everyone who wants to use ARToolKit Plus on the iPhone. This post describes how to compile ARTKP in an XCode project.
First you need to get ARTKP, there are two major versions online. One is the official v2.1, and the second is the “cleaner” v2.2. This is the one you want to download, otherwise you’ll suffer a lot… Take my word! Grab v2.2 from 
here and extract its contents  (All rights reserved to their respective owners, and if there are some copyrights that I infringe by uploading the file, someone please tell me and I will take it down ASAP)

Now for the steps:
  1. Open XCode and create a new project. Then Create a group to add the ARTKP files into.
  2. Add the “include” and “src” folders from ARTKP folder you extracted, make sure you check the “copy items to destination folder if needed”.

  3. You need to retain only the .cpp and the .h files. Delete all other files.
  4. Delete the matlab folder, otherwise you’ll get errors.
  5. Add the path to the “include” folder you just added to the header search path in XCode project settings:  



  6. Compile and Voila!
You can get around this by changing #include <malloc.h> to become #include <stdlib.h>
신고
Posted by genius3k

티스토리 툴바