0
當談到Xcode(在appstore上只有一個應用程序)時,我有點新手。我試圖創建一個新的應用程序,並開始從一個按鈕播放聲音的基本功能,一旦我得到它的工作,我打算讓用戶更改設置等。無論如何,當我運行該項目時,我得到一個錯誤@implementation ViewController中的ViewController.m表示「不完整的實現」。這並沒有發生與我的其他應用程序,我已經通過複製所有代碼,但它仍然沒有工作。 這是我ViewController.h代碼:ViewController的不完整實現[Xcode]
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
@interface ViewController : UIViewController{
}
-(IBAction)sound1;
@end
,這是我ViewController.m代碼:
#import "ViewController.h"
@implementation ViewController
-(IBAction)sound1 {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"sound1", CFSTR ("mp3"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
- (void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return interfaceOrientation == UIInterfaceOrientationPortrait;
}
@end
所以我做錯了什麼?每一個我工作的項目都會發生這種情況,這有什麼問題?我尋覓其他的問題,但不完全理解(IM相當新的這個) 感謝您的幫助
錯誤消息應該說哪些方法沒有實現。你能粘貼上面的整個錯誤信息嗎? – user1118321