2013-01-14 4 views
0

4 가지 Xcode 프로젝트 (GPS, 가속도계, 나침반 및 MySQL)가 있습니다.Xcode는 GPS 프로젝트, 가속도계 프로젝트, 나침판 프로젝트 및 MySQL 프로젝트 병합에 도움이 필요합니다.

각각 개별적으로 잘 컴파일되어 잘 작동합니다.

GPS, 가속도계 및 나침반 정보를 mySQL 데이터베이스로 보낼 수 있도록이 모든 것을 하나의 프로젝트로 결합하고자합니다.

.h.m과 프로젝트에서 필요한 프레임 워크를 다른 것으로 복사하려고 시도했습니다.

주로 문제는 여기서 발생한다 :

+0

무슨 문제? 아니면 우리가 당신을 위해 모든 MySQL 코드를 복사하기를 원합니까? – MCKapur

+0

안녕하세요, 제가 가지고있는 문제는 아래의 speedLabel 변수에 액세스 할 수 없다는 것입니다. NSString * strURL = [NSString stringWithFormat : @ "http : //localhost/phpFile.php? speedLabel = % @", speedLabel.text]; 내 코드에서 시도 할 때 정의되지 않은 식별자 speedLabel 사용 오류가 있습니다. 감사 Regisma – user1961175

답변

0

당신이 당신의 .H 파일을 가져 오는 당신의 도움에 대한

@interface CoreLocationDemoViewController : UIViewController <CoreLocationControllerDelegate> { 
    CoreLocationController *CLController; 
    IBOutlet UILabel *speedLabel; 
    IBOutlet UILabel *latitudeLabel; 
    IBOutlet UILabel *longitudeLabel; 
    IBOutlet UILabel *altitudeLabel; 
    IBOutlet UILabel *timeLabel; 
} 

감사 : 여기

- (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가 포함되어있는 구조입니다

#import "CoreLocationDemoViewController.h" 

코드에서 결함이 전혀 보이지 않습니다.

해당 코드는 @implementation@end 범위 내에서 호출됩니까? 당신은 속성으로 선언하고 다음 작업을 수행하고 있습니까 @synthesize 그것은

내가 유래 어딘가에서 발견 않았다 아래의 기술을 사용 않았다 GPS 인터페이스에서 오는 변수를보기 위해
+0

안녕하세요, mySQL에 대한 인터페이스는 ConnectToDBAppDelegate.h 아래에 성명 NSString * strURL = [NSString stringWithFormat : @ "http : //localhost/phpFile.php? name = % @", speedLabel.text]; ConnectToDBAppDelegate.m 아래에 있습니다. GPS 정보는 CoreLocationDemoViewController.h 아래에 있으며 speedLabel에 대한 @synthesize는 CoreLocationDemoViewController.m 아래에 있습니다. ConnectToDBAppDelegate.m에서 CoreLocationDemoViewController.h를 가져 왔습니다. 감사합니다 Regis – user1961175

0

:

// Globals.h 
#ifndef Globals_h 
#define Globals_h 

extern NSInteger globalVariable; 

#endif 

// main.m 

NSInteger globalVariable; 

int main(int argc, char *argv[]) 
{ 
    globalVariable = <# initial value #>; 
    ... 
} 

// Prefix.pch 

#ifdef __OBJC__ 
    #import 
    #import <Foundation/Foundation.h> 
    #import "Globals.h" 
#endif 

을 그리고 저는이 기술을 사용했습니다 :

NSString *strURL = [NSString stringWithFormat:@"http://localhost/phpFile.php?name=%@",speedLabel.text]; 

정보를 mysql 데이터베이스로 보내주십시오.

하지만 여전히 약간의 도움이 필요합니다.

나는 GPS 용으로 하나, 가속도계 용으로 하나, 나침반 용으로 하나의 인터페이스를 가지고있다. 아이폰에서 하나의 버튼을 클릭하여 각각에 관련된 데이터를 저장할 수 있도록 어떻게 각각을 호출 할 수 있습니까?

많은 감사

Regisma

+0

안녕하세요, 가속도계와 같은 다른 인터페이스에서 데이터에 액세스하려는 경우 안녕하세요, 트릭이 작동하지 않는 것 같습니다. 제발 나를 안내해 주시겠습니까? 감사합니다 레지스 – user1961175