これはばかげています。アプリのサウンドで有効にするサウンドブールを作成しようとしています。私は得続けます
Undefined symbols for architecture i386:
"_kPlaySoundPrefsKey", referenced from:
-[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
すべてのファイルがビルド フェーズでリンクされていることを確認しました。ビュー コントローラで bool を呼び出す前にエラーが発生する appdelegate .m を削除し、ビルド フェーズで再インポートしました。関連するフレームワークが整っていることを確認しました。同じコードで作成した以前のアプリもチェックしましたが、コードはエラーなしでまったく同じように見えます(以前のバージョンのxcodeでビルドされました)。基本に戻って、次のコードを App Delegate に追加するとすぐにエラーが発生します。
.h
#import <UIKit/UIKit.h>
extern NSString *kPlaySoundPrefsKey;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
.m
#import "AppDelegate.h"
#import <AudioToolbox/AudioToolbox.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
NSDictionary *defaultDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
forKey:kPlaySoundPrefsKey];
return YES;
}
ビルドに変更extern NSString *kPlaySoundPrefsKey;
する NSString *kPlaySoundPrefsKey;
とクラッシュします...今はアイデアがありません