开发者

How can I create an new issue in redmine use objective-c

I want to create an new issue, I use the code below:

NSString *xml = [NSString stringWithFormat:@"<?xml version=\"1.0\"?>\n"
                      "<issue>\n"
                      "<subject>test create</subject>\n"
                      "<project_id>2</project_id>\n"
                      "<priority_id>2</priority_id>\n"
                     "<status_id>1</status_id>\n"
                     "<tracker_id>1</tracker_id>\n"
                     "<assigned_to_id>1</assigned_to_id>\n"
                      "</issue>"];
    NSDictionary *nameDic = [[NSUserDefaults standardUserDefaults] objectForKey:ActiveShare_Account];
    NSString *url = [NSString stringWithFormat:@"http://%@:%@%@/issues.xml", [nameDic objectForKey:@"username"], [nameDic 开发者_运维技巧objectForKey:@"password"], BASICE_URL];
    NSURL *urlU = [NSURL URLWithString:url];
    NSLog(@"add new issue: %@", url);
    ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:urlU];        
    [request setRequestMethod:@"POST"];
    [request addRequestHeader:@"Content-Type" value:@"application/xml"];
    [request setPostBody:(NSMutableData *)[xml dataUsingEncoding:NSUTF8StringEncoding]];
    request.delegate = self;
    [request startSynchronous];
    NSError *error = [request error];
    if (error) {
        NSLog(@"error: %@", error);
    }
    else {

        NSLog(@"send ok");
    }

but I can not create the issue, the address is correct, I use the address successfully update the issue and delete issue, Could you someone can help me? Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜