ShareKit API 更改
我正在尝试将附件的 ShareKit API 代码更改为以下代码:
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\"
:\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"http://example.com/example.png\"
,\"href\": \"http://example.com/\"}]} ",item.title == nil ? SHKEncodeURL(item.URL)
SHKEncode(item.title),SHKEncodeURL(item.URL)];
Xcode 不断告诉我前缀错误。 我缺少什么?
I am trying to change ShareKit API code of attachment to this code below:
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\"
:\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"http://example.com/example.png\"
,\"href\": \"http://example.com/\"}]} ",item.title == nil ? SHKEncodeURL(item.URL)
SHKEncode(item.title),SHKEncodeURL(item.URL)];
Xcode Keeps telling me prefix error.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很遗憾地说,但是您的代码是一大段意大利面条代码。它很难阅读、容易出错并且难以维护(不仅对你来说,对你的程序员同事也是如此)。
我想建议稍微分解一下代码 - 例如:
遵循可读的代码风格肯定会节省您的时间,同时解决类似的语法错误。
I'm sorry to say, but your code is one big piece of spaghetti code. It is hard to read, prone to mistakes and hard to maintain (not only for you, but for your fellow coders as well).
I'd like to suggest breaking down the code a bit - for example:
Following a readable code style will definitely save you time while solving similar syntax errors.
三向条件句中缺少一个冒号;
原来的代码是这样的:
改成这样
错误在第三行末尾。
您应该在 XCode 编辑器中看到过这一点,在错误所在的位置下方有一个黄色的小字符。
You are missing an colon in the three-way conditional;
The original code looks like this:
Change it to this
The error is at the end of the third line.
You should have seen this in the XCode editor, with a little yellow charat under the position where the error is.