私はiphoneでbigcommerceapiを使用してそこからデータをフェッチしているので、xml解析の助けを借りてそれを行っていますが、注文のリストを取得するには、bigcommerce Webサイトへのログインを要求し、誰かがこれで私を助けてくれればデータを解析しますそれから私は非常に感謝します、私たちがログイン資格情報を送信する方法をxml解析して教えてくださいそしてそれからデータを解析するためにurlを押してください.....
ありがとうございました
私はこのコードを書いています
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Add the navigation controller's view to the window and display.
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
// Override point for customization after application launch.
NSString *string=[NSString stringWithFormat:@"https://www.labradorhometraining.com/api/v2"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:string]];
// NSString *dataString = [NSString stringWithFormat:@"{\"screenName\":\"%@\",\"password\":\"%@\",\"pushToken\":\"%@\",\"deviceType\":\"%@\"}", Screentxtf.text,passtxtf.text, str, deviceType];
[request setRequestMethod:@"GET"];
[request appendPostData:[string dataUsingEncoding:NSUTF8StringEncoding]];
// Basic YWRtaW46cGFzc3dvcmQ=
[request addRequestHeader:@"Content-Type" value:@"application/xml"];
[request addRequestHeader:@"Authorization: Basic ZGVtb2tleTpkZW1vdG9rZW4= " value:[NSString stringWithFormat:@"%@ %@",@"api", @"c275ab4076f87"]];
[request setUseSessionPersistence:NO];
[request setUseCookiePersistence:NO];
[request setCacheStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
[request setDelegate:self];
[request startAsynchronous];
return YES;
}
これはルートビューコントローラにあります
-(void)gototselect{
NSString *string=[NSString stringWithFormat:@"https://www.labradorhometraining.com/api/v2/orders.xml"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:string]];
// NSString *dataString = [NSString stringWithFormat:@"{\"screenName\":\"%@\",\"password\":\"%@\",\"pushToken\":\"%@\",\"deviceType\":\"%@\"}", Screentxtf.text,passtxtf.text, str, deviceType];
[request setRequestMethod:@"PUT"];
// [request appendPostData:[string dataUsingEncoding:NSUTF8StringEncoding]];
[request addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"%@ %@",@"api", @"c2714076f87"]];
[request allowCompressedResponse];
[request setUseSessionPersistence:NO];
[request setUseCookiePersistence:NO];
[request setCacheStoragePolicy:ASICacheForSessionDurationCacheStoragePolicy];
[request setDelegate:self];
[request startAsynchronous];
}