Spaces in a NSURL with variables doesn't load

前端 未结 4 1680
暖寄归人
暖寄归人 2021-01-20 05:07

Hello everyone I have an objective-c dilema :P I am quite new to objective-c, and I have tried searching for an answer, but to no avail.

So, here is my situation. I

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-20 05:59

    If you're not using printf-style formats, don't use stringByAppendingFormat:. Use stringByAppendingString: instead.

    Second, is the resulting URL really supposed to be http://www.myside.ca/exampleannouncements%20%@%20%d%20carson.ashx? Or is there supposed to be a slash in the middle: http://www.myside.ca/example/announcements%20%@%20%d%20carson.ashx?

    Also, http://www.myside.ca/exampleannouncements%20%@%20%d%20carson.ashx is an invalid URL. The percent signs that are not part of an escape (e.g. not part of %20) must themselves be encoded, as %25. Technically, the @ should also be escaped (as %40), but IIRC NSURL will let that slide.

提交回复
热议问题