Lexical or Preprocessor issue ‘xxx.h’ file not found
NSMutableArray に要素をランダムに並び替える機能を入れようと思い、
objective c – What's the Best Way to Shuffle an NSMutableArray? – Stack Overflow
を見て、NSMutableArray にカテゴリを追加するために .h .m を追加したところ、ビルド時に
Lexical or Preprocessor issue ‘xxx.h’ file not found
が発生。いろいろ試したが解決できない。
いつものようにこのエラー文言で検索したところ下記を発見。
Lexical or Preprocessor issue 'Xxx.h' file not found – 悪あがきプログラマー
Xcode4再起動でビルドできるようになった。
たまにXcode再起動で直る問題がありますな…
本題と関係ないけれども、追加したカテゴリはこちら。
// NSMutableArray_Shuffling.h #if TARGET_OS_IPHONE #import <UIKit/UIKit.h> #else #include <Cocoa/Cocoa.h> #endif // This category enhances NSMutableArray by providing // methods to randomly shuffle the elements. @interface NSMutableArray (Shuffling) - (void)shuffle; @end
#import “NSMutableArray_Shuffling.h”
@implementation NSMutableArray (Shuffling)
– (void)shuffle
{
NSUInteger count = [self count];
for (NSUInteger i = 0; i < count; ++i) {
// Select a random element between i and end of array to swap with.
int nElements = count - i;
int n = (arc4random() % nElements) + i;
[self exchangeObjectAtIndex:i withObjectAtIndex:n];
}
}
@end
[/c]
関連記事
-
-
ドラムアプリ「ドラムちゃん」用に電子ドラムiWordを買ってみた
自作ドラム学習アプリ「ドラムちゃん」には以前からMIDIドラムを接続することができたが、これまでな
-
-
GoodNotes5使いこなし
iPad Pro 12.9インチを購入した 理由の一つである、Apple Pencil
-
-
[iPhone5] 使用開始5日目の感想
au iPhone5を発売日翌日(9/22)に購入してから5日経ったので感想を書いてみる。 し
-
-
Jony Ive: The Genius Behind Apple’s Greatest Products
Jony Ive: The Genius Behind Apple's Greatest Produ
-
-
Xcode 設定しておくと便利なカスタマイズいろいろ
以前から Xcode はもう一歩使いにくいと思っていたが、iPhone アプリで稼げるのか でカスタ
-
-
LogLocations 1.3.4 リリース
久しぶりに、LogLocations をアップデートしました。今までピンを置いていた画面に、時刻を表
-
-
新アプリ「コードちゃん」を公開しました
速報:新 iPad 発表。Apple Pencil対応で3万7800円から - Engadget
-
-
QUICCO Sound mi.1rev.3
Bluetooth でMIDI信号を飛ばせる QUICCO sound mi.1 について。以前 K
-
-
[iOS SDK] iPad 専用アプリをiPhoneでも使えるようにする
iPad 初代やiPad2の頃は、iPhoneとiPadの画面サイズがかなり異なり、また