|
|
아이폰 SQLite 사용할 때 하기와 다음과 같은 메세지가 나올 때가 있다.
'NSInternalInconsistencyException', reason: 'Error
while inserting data. 'not an error''
해결법: DB 스키마 중 Primary 키 옵션이 있는 필드에 autoincrease 옵션을 On으로 설정하면 됨.
그남자
2010/04/07 15:05
2010/04/07 15:05
Trackback Address >> http://gnamja.com/tc/trackback/182
UIWebView 클래스를 이용하다보면, 가끔 로딩한 웹뷰 컨텐츠 내에서 어떤 이벤트가 일어나는지 가로채고 싶을 때가 있습니다. 예를 들면, Resource 폴더 내에 내가 원하는 .html 파일을 넣고, 그 폴더에서 Get 방식으로 파라미터를 특정 서버에 전달하는 경우에 정작 사용자가 만든 프로그램 내에서는 이 이벤트가 어떻게 서버로 흘러 들어가는지를 포착하기가 어려운 것이 현실입니다. UIWebView는 로딩만 할뿐, 안에 로딩된 컨텐츠가 어떻게 전달되는지는 미궁이겟죠.. 그러나 역시나 이러한 이벤트에 대한 사용 가능한 함수가 있었네요. 이용법은 다음과 같습니다. @interface WebBrowserTutorialAppDelegate : NSObject <UIWebViewDelegate> {
일단 델리게이트 부분에 웹뷰 델리게이트를 추가해주시고요...
webView.delegate = self;
웹뷰 변수 엔트리 부분에 델리게이트를 원하는 부분에 추가를 합니다.
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = request.URL; NSString *urlString = url.absoluteString; NSLog(urlString); return YES; } 그리고 위에서 처럼, shouldStartLoadWithRequest 함수를 포함해서 이용하시면 되는데요. 먼저, request라는 변수는 웹뷰에 로드된 컨텐츠에서 어떤 리퀘스트가 있을때 들어오는 변수인데, 다음과 같은 것으로 구성이 되어 있습니다.
* absoluteString – An absolute string for the URL. Creating by resolving the receiver’s string against its base. * absoluteURL – An absolute URL that refers to the same resource as the receiver. If the receiver is already absolute, returns self. * baseURL – The base URL of the receiver. If the receiver is an absolute URL, returns nil. * host – The host of the URL. * parameterString – The parameter string of the URL. * password – The password of the URL (i.e. http://user:pass@www.test.com would return pass) * path – Returns the path of a URL. * port – The port number of the URL. * query – The query string of the URL. * relativePath – The relative path of the URL without resolving against the base URL. If the receiver is an absolute URL, this method returns the same value as path. * relativeString – string representation of the relative portion of the URL. If the receiver is an absolute URL this method returns the same value as absoluteString. * scheme – The resource specifier of the URL (i.e. http, https, file, ftp, etc). * user – The user portion of the URL. 많은 것을 알수가 있죠?
금번에 새로 나오게 될 저의 5번째 어플에서는 이와 같이, 원래는 다른 사이트에 GET을 통해 특정 파라미터를 보내 서버의 특정 정해진 사이트로 이동하려는 것을 가로채어서, GET 방식의 파라미터만 추출해서 결과 사이트에서 저의 입맛에 맞게 다시 재조정하여 파싱한 사이트만을 보이기 위해 위의 방법을 이용하였습니다. 실재로 생각보다 더 많은 기능이 SDK에 포함이 되어 있습니다. 다소 횡설수설했네요;;;
그남자
2009/11/08 22:52
2009/11/08 22:52
Trackback Address >> http://gnamja.com/tc/trackback/173
#1. Including below classes @interface UIProgressIndicator : UIActivityIndicatorView { }
+ (struct CGSize)size; - (int)progressIndicatorStyle; - (void)setProgressIndicatorStyle:(int)fp8; - (void)setStyle:(int)fp8; - (void)setAnimating:(BOOL)fp8; - (void)startAnimation; - (void)stopAnimation; @end
@interface UIProgressHUD : UIView { UIProgressIndicator *_progressIndicator; UILabel *_progressMessage; UIImageView *_doneView; UIWindow *_parentWindow; struct { unsigned int isShowing:1; unsigned int isShowingText:1; unsigned int fixedFrame:1; unsigned int reserved:30; } _progressHUDFlags; }
- (id)_progressIndicator; - (id)initWithFrame:(struct CGRect)fp8; - (void)setText:(id)fp8; - (void)setShowsText:(BOOL)fp8; - (void)setFontSize:(int)fp8; - (void)drawRect:(struct CGRect)fp8; - (void)layoutSubviews; - (void)showInView:(id)fp8; - (void)hide; - (void)done; - (void)dealloc; @end #2. Declaration of an instance UIProgressHUD *progressHUD; #3. Using method in UIViewController [self showProgressIndicator:@"Detecting"]; #4. Showing and hiding method - (void)showProgressIndicator:(NSString *)text { //[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; self.view.userInteractionEnabled = FALSE; if(!progressHUD) { CGFloat w = 160.0f, h = 120.0f; progressHUD = [[UIProgressHUD alloc] initWithFrame:CGRectMake((self.view.frame.size.width-w)/2, (self.view.frame.size.height-h)/2, w, h)]; [progressHUD setText:text]; [progressHUD showInView:self.view]; } }
- (void)hideProgressIndicator { //[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; self.view.userInteractionEnabled = TRUE; if(progressHUD) { [progressHUD hide]; [progressHUD release]; progressHUD = nil;
AudioServicesPlaySystemSound(alertSoundID); } }
그남자
2009/09/15 10:25
2009/09/15 10:25
Trackback Address >> http://gnamja.com/tc/trackback/152
 #1. http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=325898952&mt=8 #2. 두번째 앱스토어 등록프로그램이 금일부로 Ready in sales 상태로 전환이 되었습니다. 애플의 QA 기간이 다소 길었고, 유료 어플이였는지 다소 신중한 것 같은 느낌이랄까. #3. 프로그램 개요 본 프로그램은 네트워크 카메라 마켓 쉐어 1위인 Axis사의 카메라를 아이폰을 통해 원격지에서 볼 수 있는 프로그램이고, 아이폰에 빌트인 되어있는 터치 센서, 가속도 센서를 통해서 원격지 카메라를 PTZ(panning, tilting, zooming)할 수 있는 기능을 담고 있습니다. 계정은 프로그램당 한개의 카메라를 붙일 수 있고, 기회가 되면 가격을 더 올려 멀티 카메라를 볼 수 있도록 할 생각만(?) 가지고 있습니다. 사실상 하드웨어 디펜던트한 프로그램이기 때문에 개인들의 수요는 고려하지 않은 상태입니다. #4. 카테고리는 Utility, 유료 어플 $3.9. #5. seller의 이름은 센터장님입니다;;;; #6. 개발 모듈은 사파리 객체, axis 카메라 http api, 아이폰 가속도 센서 클래스, 터치 센서 클래스를 이용하였고, 자세한 테크니컬 이슈는 비밀입니다.;;;;;;;;;
그남자
2009/09/11 09:14
2009/09/11 09:14
Trackback Address >> http://gnamja.com/tc/trackback/148
출처: http://ildan.blogspot.com/2008/07/creating-universal-static-opencv.html We will create a minimal static universal OpenCV library with 3
architectures: Intel, PowerPC and Arm for the iPhone. I've been testing
it on Leopard but it should work on any Mac OS X version. First checkout or untar the OpenCV sources in the opencv directory. Then, on the same level (not inside) create a build directory with 3 subdirectories: ppc, i686 and armv6. (Download the code from Sourceforge) Then set the global configure settings: $ export CONFFLAGS="--without-imageio
--without-python --without-swig --disable-apps
--disable-dependency-tracking --without-carbon --without-quicktime --enable-shared=no --without-gtk" in the ppc dir: $ ../../opencv/configure ${CONFFLAGS} --host=ppc-apple-darwin9 $ make CXXFLAGS="-arch ppc" in the i686 dir: $ ../../opencv/configure ${CONFFLAGS} --host=i686-apple-darwin9 $ make CXXFLAGS="-arch i686"
in the arm dir: $ ../../opencv/configure ${CONFFLAGS}
--host=arm-apple-darwin9
CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1
CXXFLAGS="-arch armv6 -isysroot
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk"
CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp $ make
the last one is tough, so let's see the variables one by one: CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1 CXXFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk" CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
Ok. Now for the universal static libs: $ lipo -create i686/cv/src/.libs/libcv.a ppc/cv/src/.libs/libcv.a armv6/cv/src/.libs/libcv.a -output libcv.a $
lipo -create i686/cxcore/src/.libs/libcxcore.a
ppc/cxcore/src/.libs/libcxcore.a armv6/cxcore/src/.libs/libcxcore.a
-output libcxcore.a $ lipo
-create i686/cvaux/src/.libs/libcvaux.a ppc/cvaux/src/.libs/libcvaux.a
armv6/cvaux/src/.libs/libcvaux.a -output libcvaux.a $ lipo -create i686/ml/src/.libs/libml.a ppc/ml/src/.libs/libml.a armv6/ml/src/.libs/libml.a -output libml.a $
lipo -create i686/otherlibs/highgui/.libs/libhighgui.a
ppc/otherlibs/highgui/.libs/libhighgui.a
armv6/otherlibs/highgui/.libs/libhighgui.a -output libhighgui.a
That's all. Oh, try $ make -j 2
그남자
2009/07/03 15:29
2009/07/03 15:29
Trackback Address >> http://gnamja.com/tc/trackback/112
출처: http://knol.google.com/k/usman-ismail/iphone-sdk-application-preferences/34oprzanmpe7q/8#
Step 1: Create a Sample Application
I have used an application similar to the one created in the tutorial presented here ( IPhone SDK Hello World). Step 2: Create a Settings Bundle Create a new File Command + N and then select Settings from the side menu and Settings Bundle. The file must be named Settings.bundle to work correctly. This
will create two new files Root.strings and Root.plist. Open the
Root.plist file and you should see the following screen listing some
sample settings. This is actually a graphical representation of an XML
file which defines the settings and how they are displayed. (You can
see the xml code by right clicking the file and selecting Open as Plain Text) Step 3: Define Settings Schema The Root element has three child elements (1) Title; which defines the title of this settings view and is set to the name of the application. (2) StringTable; which is not covered in this tutorial. (3) PreferenceSpecifiers
which contains all the settings we wish to elicit from the user.
PreferenceSpecifiers has type Array and has a child element of type
Dictionary for each setting: Item 1, item2 and so forth. We can add
items by selecting PreferenceSpecifiers and clicking the Grey button at
the end of the row. Each setting has several properties of type
string including the common required properties; Title and Type (Note
all strings are case sensitive). The title defines the label displayed
beside the control used to modify the setting and type defines the type
of control used. There are seven possible controls which can be
selected using the Type property: PSGroupSpecifier
This is the simplest control and has only the two properties defined
described above. It is used as a separator to break-up groups of
similar settings. It cannot accept any input from the user. PSTitleValueSpecifier
This displays a "Read Only" setting it cannot accept input from the
user but can be used to display settings changed elsewhere.
Key: This
is a String property which can be set to any text, the text is used as
a key to map to the value that a user will enter into the control. DefaultValue: Another String property which can store any text, this defines the Text that will be displayed in the specifier. PSTextFieldSpecifierThe next type of control is the TextField, it has some additional properties which are listed below
Key:This
is a String property which can be set to any text, the text is used as
a key to map to the value that a user will enter into the text field.
DefaultValue:Another
String property which can store any text this defines the initial Text
that will be entered into the TextField when it is first loaded.
IsSecureThis
is a boolean property which defines if the charecters of the text field
will be hidden, set to enabled for password fields. KeyboardTypeA String property which can have one of the following values: Alphabet, NumbersAndPunctuati on, NumberPad, URL, EmailAddress. This property specifies which type of keyboard to display when text field is selected
AutocapitalizationTypeA String property which can have one of the following values: None, Sentences, Words, AllCharacters
AutoCorrectionType A String property which can have one of the following values: Default, No, Yes
PSSliderSpecifier
This displays a slider on a bar which allows the user to select a
number in a specified range. In addition to the standard Title and Type
specifiers the Slider has the following properties.
Key: This
is a String property which can be set to any text, the text is used as
a key to map to the value that a user will enter into the control. MinimumValueA property storing a numerical value which corresponds to the slider being on the left end of the bar.
MaximumValue A property storing a numerical value which corresponds to the slider being on the right end of the bar. DefaultValue: A numerical property which defines the original position of the slider.
PSToggleSwitchSpecifier Displays a toggle switch which can be either On or Off.
Key: This
is a String property which can be set to any text, the text is used as
a key to map to the value that a user will enter into the control. TrueValue: A boolean property which defines the value of the control of the toggle button is in the On position.
FalseValue: A boolean property which defines the value of the control of the toggle button is in the Off position. DefaultValue: A boolean property which defines the position of the Toggle button the first time it is loaded.
PSMultiValueSpecifier | Multi-Value Specifier
| Displays a list in a second view and allows the user to select one element from the list.
Key:
This is a String property which can be set to any text, the text is
used as a key to map to the value that a user will enter into the
control.
Values:A
property of type Array which stores sub-elements of type String, each
element provides a a pos sible value for the control to take.
Titles: A
property of type array which stores sub-elements of type String, each
element provides a textual representation of one of the values
specified in the previous property. For example if the first element of
the values array is "01" and the first element of the titles array is
"January" then the user is shown January but if January is selected the
value stored for the control is 01.
DefaultValue: Another String property that defines the initial value of the control, should be one of the elements of the Values list.
PSChildPaneSpecifier
Key:
This is a String property which can be set to any text, the text is
used as a key to map to the value that a user will enter into the
control.
File:The name of another plist file without the extension.
Step 4: Retrieving Values of SettingsYou
can retrieve the value of a setting by using the command given below;
Replace the hilighted text with the name of the setting you want to get
the value of.
NSString* settingValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"<Setting Key>"]
Step 5: Loading a Child Pane The
final of the Seven Controls allows you to add a sub view. The procedure
to do so is to add a new file Command + N and select Other from the menu on the right Property List from the list of fle types.
Create a child prefernces schema exactly as you created the original schema.
No in the original schema add a PSChildPaneSpecifier and add a File item to the specifier with the file name of the child view (less the extension).
Technically
this should be enough but as you will see if you run your code now the
child view will not load. To load your child view the child plist file
has to be inside the settings bundle but I can't find a way of doing
this from within XCode (after half an our of random tinkering). So just
open a terminal and move the file into the bundle manually. To do this
browse to the directory containing your xcode project, and find
child.plist file (or whatever you named it). Use mv child.plist
Settings.bundle/child.plist to move your file and then click Build and
Go in XCode.
If there is some way of moving files into the
bundle through XCode that you know of please leave a coment and I will
update this document.
Concluding Note This
document is a bit raw please leave feedback in case anything is not
clear, you have some suggestions or if you spot any mistakes.
You can find the source code of the example at my website; Source Code
Appendix A: NSLogs To
see the NSLog output generated by clicking the "Load Preferences"
button in the sample code click the highlighted button in shown in the
figure. It will open the log output window.
그남자
2009/07/01 14:59
2009/07/01 14:59
Trackback Address >> http://gnamja.com/tc/trackback/111
NSString *a; a라는 변수에 "그남자 천재"라는 스트링을 넣기 위해서는 a = @"/"그남자 천재/"";
위와 같이 하면 된다. 간단히 해결. 삽질 goes on.....
그남자
2009/04/08 11:57
2009/04/08 11:57
Trackback Address >> http://gnamja.com/tc/trackback/90
그렇게 많은 시간 삽질하지 않고 알게된 Get 방식을 이용한 html 코드 크로울링 소스 - (void)applicationDidFinishLaunching:(UIApplication *)application { NSString* str = [self GetGnamjaStr]; NSData* htmlData = [str dataUsingEncoding:-2147481280]; [webview loadData:htmlData MIMEType:@"text/plain" textEncodingName:@"EUC-KR" baseURL:nil]; [window makeKeyAndVisible]; }
-(NSString*)GetGnamjaStr { NSError *error; NSURLResponse *response; NSData *dataReply; NSString *stringReply; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: [NSString stringWithFormat:@"http://사이트주소"]]]; [request setHTTPMethod: @"GET"]; dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; stringReply = [[NSString alloc] initWithData:dataReply encoding:-2147481280]; return stringReply; } 소스 보시면 알겠지만 리퀘스트하고 스트링으로 받고 웹뷰에 뿌리는 것을 알 수 있음. 인코딩 관련 부분은 한글페이지 긁는 용도로 파라미터 조정함. 스트링 처리는 기회되면 나중에~~ 활용은 알아서~
그남자
2009/01/06 18:00
2009/01/06 18:00
Trackback Address >> http://gnamja.com/tc/trackback/62
from etc
2008/09/02 14:12
 KTF 출시냐, SKT 동시 출시냐로 국내에서 영원한 떡밥으로 분류가 되는 아이폰 출시를 가장 먼저 아는 방법에 대한 몇가지 팁입니다. (뭐 별건 없고, 남보다 빠르게 알 수 있는 방법입니다.) 나름 리프레시의 대왕이신 분들은 아래의 방법을 써보시는 것도 좋은 팁이 아닐까 생각되네요. 1. 전파 인증 사이트 ( http://www.rrl.go.kr/approval/status/search.jsp) 국내에 출시되는 전자 기기에는 반드시 정보통신기기 인증을 받아야 합니다. 따라서, 위의 링크에서 분류에서는 전자파적합등록(정보기기)를 선택하고, 상호 명에 애플을 입력하면 연도 역순으로 1999년도부터 인증을 위한 애플 프로덕이 좌르륵 나옵니다. 이때, 맨 마지막 페이지에서 아이폰이 뜨는 시점이 바로 출시가 임박했다는 것을 말해줍니다. 2. 애플 사이트 무한 리프레시 ( http://www.apple.com/kr/iphone/) 애플 사이트는 apple.com/지역코드/iphone의 형태로 각 나라의 페이지가 뜨는 구조로 되어있습니다. 이전에는 위 링크가 죽어 있었는데, http://www.asia.apple.com/iphone/ 페이지로 이동하는 걸 보면 뭔 일이 벌어지기는 하는 걸까요? 3. 마찬가지로 애플 사이트 무한 리프레시 ( http://www.apple.com/iphone/countries/) 위 링크에는 coming soon이라는 메뉴가 있어서, 곧 출시 될 국가의 링크가 나옵니다. 2에서 말한 구조의 링크가 있는 반면, 카메룬이라는 나라에는 http://www.apple.com/iphone/countries/cm/ 페이지와 같은 형태로 링크가 이루어져있군요, 따라서 한국 출시 페이지를 유추해보건데, http://www.apple.com/iphone/countries/kr/ 이되겠죠? 이상 아무 영양가 없는 아이폰 출시 가장 빨리 알기 팁이였습니다.
그남자
2008/09/02 14:12
2008/09/02 14:12
Trackback Address >> http://gnamja.com/tc/trackback/24
|
|
|
댓글을 달아 주세요