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]
関連記事
-
-
Siri Shortcuts に対応
正月休み中なので、ブログ記事が書きやすい。毎年この時期だけはよくブログを書いている気がする。
-
-
iOS デバイスサポート最終バージョン
iOS9からGKSession over Bluetoothが無効に なってしまったので Multi
-
-
iPad, iPhone, Mac, PC で使える Line6 Mobile Keys
今年のCESで発表されて以来ずっと待っていたLine6のMobile Keysがついに発売される。こ
-
-
APNs のサーバー側をサポートしてくれる Urban Airship (APNs対応その2)
Apple Push Notification Service (APNs) はAppleのAPN
-
-
[iOS SDK] 物書堂の辞書アプリと連携してみた
物書堂は使い勝手のよい辞書アプリをたくさんリリースしている会社だ。 今作っている英単語学習アプリで
-
-
コードちゃん 1.0.3 アップデート
コード学習アプリ コードちゃん 1.0.3をアップデートしました。ダイアトニックコードの Bmb5
-
-
ITMS-90175 Legacy Language Designator
自分は自作アプリの非常に古いプロジェクトをいまだにメンテすることがあるので、ITMS-90
-
-
これは便利 iPhoneプログラミングUIKit詳解リファレンス
Amazonでの評判も良いし、書店で立ち読みしていくつか有用な情報を見つけたので、iPhoneプログ
-
-
省メモリプログラミング
昔買った「省メモリプログラミング」を読み返してみたら、Objective-Cで採用している参照カウン
-
-
Everio で撮影した動画を写真袋で公開する
年末に奥さんが Victor Everio GZ-HM670 で撮影した長女のバレエ動画を写真袋で