Jan 23, 2012
Tags: xcode
Notes
Jan 15, 2012
Tags: xcode
3 notes

initで確保してないNSStringは解放しない

これは「しなくていい」じゃなくて「しちゃいけない」。stringWithなんたらとかいう類のstringを生成して返すメソッドはNSStringのオブジェクトを先にautoreleaseしてから渡してくれるんだけど、autoreleaseされてるオブジェクトを明示的にreleaseするとエラー出てアプリごと落ちるので気を付けた方がいい。NSArrayのarrayとかNSDictionaryのdictionaryとか、クラスメソッドでオブジェクトの初期化までやってくれるやつも基本的にどれも「allocしてinitしてautorelease」相当の処理をやってるので同様。多分「変なとこでreleaseしたせいで落ちた」ってのの原因のかなりのとこがこれじゃないかと思うので、autoreleaseされてるオブジェクトにrelease送ってないか見てみるといいと思う。というか、俺がそれを頻繁にやらかしてる人のなので…。ついやっちゃう。

fladdict:
[NSString stringWithFormat:○○] みたいに alloc しないで作成されるオブジェクトは、関数名がcreateかcopyかnewではじまらない限り、autorelease がついていてイベントの終了時とかに自動で開放されるみたいです。

releaseの使いどころ - As Sloth As Possible 2008-11-02

releaseの使いどころ。メモリの辺りがどうしてもわからない。 - f-shinの日記 - iPhoneアプリ開発グループ 2008-11-02

メソッドの命名規則でautoreleaseかどうかを判断しないといけないのは面喰いますが、覚えて慣れるしかないですね。
通常(create, copy, newで始まらない場合)はautoreleaseなので、呼び出し元に返したい場合は [[NSString alloc] stringWithFormat:xxx] のようにallocが必須ということですね。

Jan 12, 2012
Tags: xcode
0 notes
SpringBoardによるアイコンの自動iPhone化(rounded border と glossy effect) が利かない。
一般アプリではべた塗りのアイコンを作成すれば済むが、/Applicationsアプリでは自分でアイコンのiPhonne化をしないといけない。
(逆に、一般アプリでアイコンの自動いPhone化を抑止するにはInfo.plistにUIPrerenderdIcon属性を設定する。)
一般アプリと/Applicationsアプリのアイコンpngを入れ替えたりして確かめました。
taka8aru: /Applicationsのアプリと、/var/mobile/Applicationsのアプリの出来ることの違い 2009-08-10
Jan 8, 2012
Tags: xcode
3 notes
Jan 4, 2012
Tags: xcode
0 notes
Jan 4, 2012
Tags: xcode
0 notes
Jan 3, 2012
Tags: xcode
0 notes
the didSelectRow: method of UIPickerViewDelegate is not called when user taps on already selected row. It gets called when user scrolls the view and animation ends.

Add the UITapGestureRecogniser to the UIPickerView.
Detect tap on selected (highlighted) row in UIPickerView « Andriy Gordiychuk
Jan 3, 2012
Tags: xcode
0 notes
Jan 1, 2012
Tags: xcode
1 note

iPhone Software Development: How to compile command line utility for iPhone using XCode gcc

$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0  -arch armv6 -mthumb -isysroot  /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk -o  hello hello.c

$ export  CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
$ codesign -f -s "iPhone Developer" hello

Dec 29, 2011
Tags: xcode
0 notes
iOS 5.0.1 Untethered Jailbreak Released, and in same time launchctl error is fixed with Corona 1.0-3
Corona - iDownloadBlog keyword
Dec 25, 2011
Tags: xcode
1 note

system()関数を利用することでコマンドを実行できます。

Linuxで詳細な終了ステータスを取得したい場合、WEXITSTATUS()マクロを利用します。

Linuxでコマンドの実行結果を取得する - 全ては時の中に…
Dec 25, 2011
Tags: xcode
1 note

Disabling UITabBar Items

With Xcode tab bar app template;

#include “YourAppDelegate.h”

UIApplication *app = [UIApplication sharedApplication];
YourAppDelegate *ad = (YourAppDelegate *)app.delegate;
[[ad.tabBarController.tabBar.items objectAtIndex:1] setEnabled:NO];

UIApplication or UIApplicationDelegate can hold “global variable” on their property.

cf) Derek Neely » iPhone Development – Global Variables (Singleton)
cf) disable tab button in tab bar controller - MacRumors Forums

Dec 25, 2011
Tags: xcode
0 notes

How to enable Syslog on iPhone fw 2.x for debugging | fosk.it! 2.0

  1. edit /System/Library/LaunchDaemons/com.apple.syslogd.plist
  2. find the /usr/…/syslogd line
  3. below that add:
    <string>-bsd_out</string>
    <string>1</string>
  4. Type: echo ‘*.* /var/log/syslog’ > /etc/syslog.conf (open /etc/syslog.conf and make sure that you have *.* /var/log/syslog without any extra characters)
  5. Type: launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
  6. Type: launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

[2011-12-31] on iOS 5, launchctl load will fail with “checkin failed”.
But rebooting lets syslogd up and running.
In addition, launchctl problem could be fixed by installing Corona 1.0-3 and reboot, thanks Saurik.

Dec 24, 2011
Tags: xcode
19 notes

Aincc's Tips: execute other App in my App

aincctip: (translated from Krean by google translate)

execute other App in my App

By specifying a particular app my apps to run is the following:
A: my App.

B: other App.


To run B from A, B will need to define a specific URL Scheme.
How to specify in the URL Scheme B are as follows:

info.plist entries with the following content is added. (Added to the source view)

<key> CFBundleURLTypes </ key>
<array>
    <dict>
     <key> CFBundleURLName </ key>
    <string> com.yourcompany.myapp (package) </ string>
<key> CFBundleURLSchemes </ key>
<array>
    <string> testsample (schema name) </ string>
</ array>
</ dict>
</ array>

When you do this, B is defined by the schema of the testsample.

In this state, as follows: B, A can be accessed.

BOOL canOpen = [[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString: @ “testsample ://”]];
if (canOpen) {
/ / App to run.
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString: @ “testsample ://”]];
}
else {
/ / Market Connection.
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString: @ “http://market address”]];
}

For more information about custom apps, and the basic app there is a defined schema, respectively.

For more information see the link below if gory seems to be.
http://iphonedevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html
http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

Dec 18, 2011
Tags: xcode
0 notes

@interface DismissableUITableView : UITableView {
}
@end


@implementation DismissableUITableView

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.superview endEditing:YES];
[super touchesBegan:touches withEvent:event];
}

@end

iphone - Dismiss keyboard by touching background of UITableView - Stack Overflow

たった2行のコーディングで出っぱなしのソフトウェアキーボードを消す方法

Navigate
« To the past Page 1 of 4
About