아래 화면과 같이 -DDEBUG=1 항목을 추가



프로젝트명-Prefix.pch 파일에 다음을 추가


#ifdef DEBUG

    #define NSLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )

#else

    #define NSLog( s, ... )

#endif


출처 : 아이군의 블로그

http://theeye.pe.kr/entry/upgrade-NSLog-only-working-debug-mode


'iPhone Dev.' 카테고리의 다른 글

NSURLConnection 사용하기  (0) 2013.04.25
Default.png 설정  (0) 2013.04.22
IB없는 Window-based Application 프로젝트 시작하기  (0) 2011.05.11
NSArray를 plist 파일로 저장  (0) 2011.05.04
C# Push Notification Provider 구현  (8) 2010.07.31
Posted by NuBiFoRM :

Default.png 설정

2013. 4. 22. 21:06 from iPhone Dev.

디바이스 따른 Default.png 파일명 및 해상도 설정 방법


 - Default.png (320x480)


 - Default@2x (640x960)


 - Default-568h@2x (640x1136)


Posted by NuBiFoRM :

April 16, 2013

2013. 4. 16. 23:50 from Development Log

2년만에 아이폰 개발 시작.


Mountain Lion 클린설치 부터 난관.

4번 재설치 이후 설치 완료.


Xcode 설치 및 HelloWorld 빌드.


오늘은 여기까지.


'Development Log' 카테고리의 다른 글

Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
OSX OpenJDK 설치  (0) 2020.09.04
May 16, 2011  (0) 2011.05.16
청주버스 1.03.52 Release (April 29, 2011)  (0) 2011.05.02
Posted by NuBiFoRM :

May 16, 2011

2011. 5. 16. 00:38 from Development Log


 처음 보여지는 지도 UI부분을 상당가량 수정하고 있습니다. 이번 버전에서 검색 기능과 북마크 기능을 추가하려다 보니 대대적인 UI수정이 필요했습니다. 여타 버스앱과 같이 아래쪽에 탭바를 두어 여러개의 화면으로 구성할 방법도 생각해 보았지만 그것보다는 기본앱인 구글맵UI 형태를 많이 참고하였습니다. 검색을 위한 창을 다른 화면으로 두는 것이 아니라 화면 이동없이 한 화면 상에서 가능하도록 구현 중입니다.

'Development Log' 카테고리의 다른 글

Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
OSX OpenJDK 설치  (0) 2020.09.04
April 16, 2013  (0) 2013.04.16
청주버스 1.03.52 Release (April 29, 2011)  (0) 2011.05.02
Posted by NuBiFoRM :

Window-based Application 으로 프로젝트를 생성한다. 여기서는 프로젝트명을 Sample 이라고 하였다.



MainWindow.xib 파일을 선택하여 delete 키를 눌러 삭제한다.


Also Move to Trash 를 선택하여 프로젝트에서 완전히 삭제한다.



Sample-Info.plist 파일을 열고 Main nib file base name 항목을 삭제한다.


main.m 파일을 다음과 같이 수정한다.



#import <UIKit/UIKit.h>


int main(int argc, char *argv[]) {

    

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    int retVal = UIApplicationMain(argc, argv, nil, @"SampleAppDelegate");

    [pool release];

    return retVal;

}


SampleAppDelegate.h 파일에서 다음과 같이 @property 부분을 삭제한다.

#import <UIKit/UIKit.h>


@interface SampleAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

}


@property (nonatomic, retain) IBOutlet UIWindow *window;


@end


SampleAppDelegate.m 파일에서 @synthesize 부분을 삭제한다.

@synthesize window;


application:didFinishLaunchingWithOption: 메서드를 다음과 같이 구현해 준다.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    

    // Override point for customization after application launch.

    

    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    

    [window makeKeyAndVisible];

    

    return YES;

}


이로써 IB가 완전히 제거된 Window-based Application 프로젝트가 생성되었다.

 
Posted by NuBiFoRM :

NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"list.plist"];

NSMutableArray *list = [[NSMutableArray alloc] initWithContentsOfFile:path];


if (list == nil) {

    list = [[NSMutableArray alloc] init];

}


[list addObject:@"서울"];

[list addObject:@"대전"];

[list addObject:@"대구"];

[list addObject:@"부산"];


[list writeToFile:path atomically:YES];

[list release];


다음과 같은 경로로 이동하면 list.plist 파일이 하나 생성되어 있다.

/Users/[User Name]/Library/Application Support/iPhone Simulator/[Version]/Applications/[Bundle Identifier]/Documents

이것을 Property List Editor로 열어보면 입력한 데이터를 확인할 수 있다.


여기서 중요한 것은 initWithContentsOfFile: 메서드를 통해NSArray 를 초기화 할때 해당 파일이 존재 하지 않는 경우 리턴되는 값은 nil 이라는 것이다. 그러므로 plist 파일을 읽어들여 초기화를 할 경우 반드시 nil 검사를 하여 파일이 존재하지 않을 경우 init 메서드를 통한 초기화가 필요하다.
Posted by NuBiFoRM :


 이번 업데이트에서는 정류장 도착정보를 확인하는 뷰에서 데이터를 자동으로 리프레쉬 하는 기능을 추가하였습니다.

 데이터 리프레쉬가 진행되는 동안 그동안 사용했던 로딩 뷰를 제거하고 변경된 데이터만 테이블 뷰에 반영되도록하여 데이터가 변화할 때 마다 자연스럽게 셀이 업데이트 되도록 구현하였습니다.

 다음 업데이트에서는 북마크 기능을 추가할 예정이며 지도상에서 버스 노선을 보여주는 부분은 문제점을 좀더 해결한 후에 반영할 것입니다.

 그리고 푸시메시지를 이용한 버스도착 알림을 구현하는 부분도 고려하고 있습니다. 그러나 문제점은 푸시 알람을 이용하게 되면 푸시 서버가 별도로 필요하게 되며 이에 대한 운영 비용도 만만치 않은지라 많은 고민을 안고 있으며 한가지 해결책으로 앞으로 배너 광고를 운영을 위한 수입원으로 사용할 방법도 검토중에 있습니다.

'Development Log' 카테고리의 다른 글

Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
OSX OpenJDK 설치  (0) 2020.09.04
April 16, 2013  (0) 2013.04.16
May 16, 2011  (0) 2011.05.16
Posted by NuBiFoRM :

계층형 게시판 구조(Oracle)

2010. 12. 21. 12:40 from PL/SQL
테이블 생성
create table board (
    no number primary key,
    title varchar2(100),
    contents varchar2(4000),
    writer varchar2(20),
    regdate date default sysdate,
    hit number default 0,
    grp number,
    seq number default 1,
    lvl number default 0
);

시퀀스 생성
create sequence board_no_seq start with 1 increment by 1;

새글 작성
insert into board
(no, title, contents, writer, grp) values
(board_no_seq.nextval, [제목], [내용], [작성자], board_no_seq.currval);

답글 작성
update board
set seq = seq + 1
where grp = [게시물번호] and seq > (select seq from board where no = [게시물번호]);

insert into board
(no, title, contents, writer, grp, seq, lvl) values
(board_no_seq.nextval, [답글제목], [답글내용], [작성자],
(select grp from board where no = [게시물번호]),
(select seq from board where no = [게시물번호]) + 1,
(select lvl from board where no = [게시물번호]) + 1);

게시물 목록
select * from board
order by grp desc, seq;

Posted by NuBiFoRM :

C# String NGram 분할

2010. 8. 4. 15:59 from C#
static Array NGram(String src)
{
ArrayList result = new ArrayList();
for (int i = 0; i < src.Length; i++)
{
if (src.Length - i > 1)
{
for (int j = 0; j < i + 1; j++)
{
result.Add(src.Substring(j, src.Length - i));
}
}
}
return result.ToArray();
}


'C#' 카테고리의 다른 글

String을 토큰으로 String을 분리하여 Array로 저장  (2) 2010.07.16
Posted by NuBiFoRM :


Apple Development Push Service 인증서와 private key를 함께 선택하여 P12 형식으로 Export 한다.

터미널을 실행시켜 다음과 같이 입력하여 P12 파일을 PEM 형태로 변경한다.

$ openssl pkcs12 -in cert.p12 -clcerts -out cert.pem

다음과 같은 C# 코드를 통해서 Push Message를 보낼 수 있다.

int port = 2195;
String hostname = "gateway.sandbox.push.apple.com";
String certificatePath = "cert.pem";

X509Certificate2 clientCertificate = new X509Certificate2(certificatePath);
X509Certificate2Collection certificatesCollection = new X509Certificate2Collection(clientCertificate);

TcpClient client = new TcpClient(hostname, port);
SslStream sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);

try
{
sslStream.AuthenticateAsClient(hostname, certificatesCollection, SslProtocols.Tls, true);
}
catch(Exception e)
{
client.Close();
return;
}

MemoryStream memoryStream = new MemoryStream();
BinaryWriter writer = new BinaryWriter(memoryStream);
writer.Write((byte)0);  //The command
writer.Write((byte)0);  //The first byte of the deviceId length (big-endian first byte)
writer.Write((byte)32); //The deviceId length (big-endian second byte)

String deviceID = "00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000";
writer.Write(HexStringToByteArray(deviceID.ToUpper()));

String payload = "{\"aps\":{\"alert\":\"Push notification test\",\"badge\":0,\"sound\":\"default\"}}";

writer.Write((byte)0);
writer.Write((byte)payload.Length);

byte[] b1 = System.Text.Encoding.UTF8.GetBytes(payload);
writer.Write(b1);
writer.Flush();

byte[] array = memoryStream.ToArray();
sslStream.Write(array);
sslStream.Flush();

client.Close();

public static bool ValidateServerCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}

public static byte[] HexStringToByteArray(String s)
{
s = s.Replace(" ", "");
byte[] buffer = new byte[s.Length / 2];
for (int i = 0; i < s.Length; i += 2)
{
buffer[i / 2] = (byte)Convert.ToByte(s.Substring(i, 2), 16);
}
return buffer;
}

Posted by NuBiFoRM :