To change your build configuration, choose Product/Edit scheme. You can select different build configurations for run/test/profile/analyze/archive.
Which profile to use is determined in different build configurations. To view/edit a build configuration, in the left panel select the project navigator and click the top most entry (project). The settings of build configuration will show up in the right panel.
Building and submitting app to app store is done through archive, therefore the build configuration used by archive should choose distribution profile in code signing identity. However this makes the app cannot be run with Xcode. To run it you need to use developer profile as code signing identity.
Thursday, May 5, 2011
Some tips about testing iPhone in-app-purchase
1. log out of app store in system settings before testing
2. delete the old version of the app from your iphone before testing the new version of the app. For some reason the old app may not be able to enter sandbox environment
3. When testing, make sure you are in the sandbox environment. The "Confirm Your In App Purchase" alert view should show "[Environment: Sandbox]"
2. delete the old version of the app from your iphone before testing the new version of the app. For some reason the old app may not be able to enter sandbox environment
3. When testing, make sure you are in the sandbox environment. The "Confirm Your In App Purchase" alert view should show "[Environment: Sandbox]"
Friday, March 4, 2011
Use Subversion with Xcode
## create svn repo
svnadmin create /path/to/your/repo
## create directory in svn repo
svn mkdir -m "blah" file:///path/to/your/repo/trunk
## import project to svn repo
svn import ./YourProjectName -m "comments" file:///path/to/your/repo/trunk/YourProjectName
## checkout project
svn checkout file:///path/to/your/repo/trunk/YourProjectName /path/to/local/dir
## delete directory from repo
svn rm -m "blah" file:///path/to/your/repo/trunk/YourProjectName/dir
svn update
## add a file
svn add -m "blah" file
## delete a file
svn rm -m "blah" file
## commit change
svn commit -m "blah"
## make file executable in repo
svn propset svn:executable on file
It is suggested to remove build directory before importing Xcode project to svn. Build directory contains some binary files which are easily causing problem with svn.
Another common issue is library files are not imported into svn by the Xcode built-in SCM. When you checkout the project to a new location and try to build it, the build fails due to missing libraries. You need to add the libraries to svn by command line.
svnadmin create /path/to/your/repo
## create directory in svn repo
svn mkdir -m "blah" file:///path/to/your/repo/trunk
## import project to svn repo
svn import ./YourProjectName -m "comments" file:///path/to/your/repo/trunk/YourProjectName
## checkout project
svn checkout file:///path/to/your/repo/trunk/YourProjectName /path/to/local/dir
## delete directory from repo
svn rm -m "blah" file:///path/to/your/repo/trunk/YourProjectName/dir
svn update
## add a file
svn add -m "blah" file
## delete a file
svn rm -m "blah" file
## commit change
svn commit -m "blah"
## make file executable in repo
svn propset svn:executable on file
It is suggested to remove build directory before importing Xcode project to svn. Build directory contains some binary files which are easily causing problem with svn.
Another common issue is library files are not imported into svn by the Xcode built-in SCM. When you checkout the project to a new location and try to build it, the build fails due to missing libraries. You need to add the libraries to svn by command line.
Tuesday, December 14, 2010
iCycle Period Logging and Prediction Free
Free iPhone app iCycle Period Logging and Prediction Free is released. Get it from App Store.
Friday, December 10, 2010
The URL for Apps and Artists in App Store
Examples:
http://itunes.com/XuanChen (for computer and iphone)
itms://itunes.com/XuanChen (for iphone only, only one redirection)
http://itunes.com/apps/XuanChen/MassageMap3D
itms://itunes.com/apps/XuanChen/MassageMap3D
More info:
http://developer.apple.com/library/ios/#qa/qa2008/qa1633.html
http://itunes.com/XuanChen (for computer and iphone)
itms://itunes.com/XuanChen (for iphone only, only one redirection)
http://itunes.com/apps/XuanChen/MassageMap3D
itms://itunes.com/apps/XuanChen/MassageMap3D
More info:
http://developer.apple.com/library/ios/#qa/qa2008/qa1633.html
Tuesday, December 7, 2010
How to Hide Status Bar or Change Its Style in iPhone App
By default, the status bar is displayed in iPhone App. If your root view frame origin is (0,0), it will be displayed just below the status bar.
If you want to hide the status bar, add one entry to the property list of your app:
Status bar is initially hidden
and make sure it is checked.
If you want to change the style of the status bar, add one entry to the property list:
Status bar style
Do not try to change status bar style or hide it in Interface Builder. That is only for visualizing other views or controls, not really changing the status bar.
If you want to hide the status bar, add one entry to the property list of your app:
Status bar is initially hidden
and make sure it is checked.
If you want to change the style of the status bar, add one entry to the property list:
Status bar style
Do not try to change status bar style or hide it in Interface Builder. That is only for visualizing other views or controls, not really changing the status bar.
Saturday, December 4, 2010
Error: unrecognized selector sent to instance
The error means an object does not respond to a selector sent to it. Various reasons can cause this error. Today I found another one: assigning to instance variable in class method can corrupt an object and cause it not to respond to a selector which it should.
For example, you have a view controller vc. By all means you expect [vc.view addSubview:anotherView] should work but you got error:
(null): unrecognized selector sent to instance 0xblah
Then you found that this view controller has a class method which updates some instance variables. Since it worked before, you think it is OK to do that. However, after some other coding, the application was suddenly broken, and you got that error. You can still NSLog(@"%@",vc.view) and it seems to be fine, but when you check [vc.view respondsToSelector:@selector(addSubview:)] you get NO.
This is totally insane. Then you noticed the compiler output:
warning: instance variable 'adView' accessed in class method
Then you remember you did something dubious: modifying instance variable in class method. In C++ such code won't compile but in objective-c it is just a warning.
After fixing this, the error disappeared.
The lessons learned:
1. Do not access instance variables in class method. Even if it works today, it may break tomorrow.
2. Pay attention to warnings. They said bad C++ code is like bullets which can shoot your toe. I would say objective-c is even worse.
For example, you have a view controller vc. By all means you expect [vc.view addSubview:anotherView] should work but you got error:
(null): unrecognized selector sent to instance 0xblah
Then you found that this view controller has a class method which updates some instance variables. Since it worked before, you think it is OK to do that. However, after some other coding, the application was suddenly broken, and you got that error. You can still NSLog(@"%@",vc.view) and it seems to be fine, but when you check [vc.view respondsToSelector:@selector(addSubview:)] you get NO.
This is totally insane. Then you noticed the compiler output:
warning: instance variable 'adView' accessed in class method
Then you remember you did something dubious: modifying instance variable in class method. In C++ such code won't compile but in objective-c it is just a warning.
After fixing this, the error disappeared.
The lessons learned:
1. Do not access instance variables in class method. Even if it works today, it may break tomorrow.
2. Pay attention to warnings. They said bad C++ code is like bullets which can shoot your toe. I would say objective-c is even worse.
Subscribe to:
Posts (Atom)