1

我对这段代码有疑问:我尽力解决但失败了,它的构建成功但警告让我非常恼火。

// Parse content as structure (Atom feeds with element type="xhtml")
// - Use elementName not qualifiedName to ignore XML namespaces for XHTML entities
if (parseStructureAsContent) {

    // Open XHTML tag
    [currentText appendFormat:@"<%@", elementName];

    // Add attributes
    for (NSString *key in attributeDict) {
        [currentText appendFormat:@" %@=\"%@\"", key, 
            [[attributeDict objectForKey:key] stringByEncodingHTMLEntities]];
    }

    // End tag or close
    if (ELEMENT_IS_EMPTY(elementName)) {
        [currentText appendFormat:@" />", elementName];
    } else {
        [currentText appendFormat:@">", elementName];
    }

问题出在最后几行

    if (ELEMENT_IS_EMPTY(elementName)) {
        [currentText appendFormat:@" />", elementName];
    } else {
    [currentText appendFormat:@">", elementName];
    }
4

1 回答 1

7

elementName正如警告所说,下面一行中的参数没有占位符。

[currentText appendFormat:@" />", elementName];

做就是了[currentText appendFormat:@" />"];

于 2012-08-06T08:27:36.903 回答