【发布时间】:2013-01-14 11:58:29
【问题描述】:
我有 4 个 Xcode 项目(GPS、加速度计、指南针和 MySQL)。
他们每个人都单独编译并且工作正常。
我想将所有这些组合到一个项目中,这样我就可以将 GPS、加速度计和指南针信息发送到 mySQL 数据库。
我尝试将.h 和.m 以及项目所需的框架复制到另一个项目。
问题主要出现在这里:
- (IBAction)insert:(id)sender
{
// create string contains url address for php file, the file name is phpFile.php, it receives parameter :name
//NSString *strURL = [NSString stringWithFormat:@"http://localhost/phpFile.php?name=%@",txtName.text];
NSString *strURL = [NSString stringWithFormat:@"http://localhost/phpFile.php?name=%@",speedLabel.text]; ************< use of undefined identifier 'speedLabel'****
// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
// to receive the returend value
NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]autorelease];
NSLog(@"%@", strResult);
}
这是包含 speedLabel 的结构:
@interface CoreLocationDemoViewController : UIViewController <CoreLocationControllerDelegate> {
CoreLocationController *CLController;
IBOutlet UILabel *speedLabel;
IBOutlet UILabel *latitudeLabel;
IBOutlet UILabel *longitudeLabel;
IBOutlet UILabel *altitudeLabel;
IBOutlet UILabel *timeLabel;
}
感谢您的帮助
【问题讨论】:
-
有什么问题?还是您希望我们为您复制所有 MySQL 代码?
-
嗨,不,我的问题是我无法访问下的 speedLabel 变量: NSString *strURL = [NSString stringWithFormat:@"localhost/phpFile.php?speedLabel=%@",speedLabel.text]; 当我尝试在我的代码中出现错误说使用未定义的标识符 speedLabel。感谢 Regisma
标签: mysql xcode gps accelerometer compass-geolocation