为什么我会收到构建警告,说:"格式字符串不使用数据参数"?

alb*_*iti 1 xcode objective-c ios

我有这个代码的问题:我尽力解决但我失败了,它的构建成功但警告非常烦我.

// 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];
    }
Run Code Online (Sandbox Code Playgroud)

问题出在最后几行

    if (ELEMENT_IS_EMPTY(elementName)) {
        [currentText appendFormat:@" />", elementName];
    } else {
    [currentText appendFormat:@">", elementName];
    }
Run Code Online (Sandbox Code Playgroud)

Kai*_*ann 7

如警告elementName所示,下面的行中没有占位符.

[currentText appendFormat:@" />", elementName];
Run Code Online (Sandbox Code Playgroud)

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