Ios &引用;意外@in program“;复制Facebook时';s共享代码

Ios &引用;意外@in program“;复制Facebook时';s共享代码,ios,objective-c,facebook,Ios,Objective C,Facebook,我从Facebook开发者网站复制了代码,将Facebook共享集成到我的应用程序中: NSMutableDictionary<FBGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@whatsyourinneragefb:inner_age title:@Sample Inner Age

我从Facebook开发者网站复制了代码,将Facebook共享集成到我的应用程序中:

NSMutableDictionary<FBGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@whatsyourinneragefb:inner_age
                                        title:@Sample Inner Age
                                        image:@https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png
                                          url:@http://samples.ogp.me/578838518886846
                                  description:@];;

[FBRequestConnection startForPostWithGraphPath:@"me/objects/whatsyourinneragefb:inner_age"
                                   graphObject:object
                             completionHandler:^(FBRequestConnection *connection,
                                                 id result,
                                                 NSError *error) {
                                 // handle the result
                             }];  
NSMutableDictionary*object=[FBGraphObjectOpenGraphObjectForPostWithType:@whatsyourinneragefb:Innerage\u
标题:@样本内部年龄
图片:@https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png
网址:@http://samples.ogp.me/578838518886846
说明:@];;
[FBRequestConnection startForPostWithGraphPath:@“我/对象/你的内心世界FB:内心世界”
graphObject:对象
completionHandler:^(FBRequestConnection*连接,
身份证结果,
N错误*错误){
//处理结果
}];  
但是,
@whatsyourinneragefb
前面的“@”会产生错误
“程序中出现意外@
。此外,诸如
@https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png
将@https:显示为白色,其余部分突出显示为绿色,就好像它是一条注释一样,因此我觉得即使上述错误消失了,这也不会起作用。因此:

如何解决第一个错误

代码是功能性的,还是需要调整才能工作


感谢所有帮助。

Objective-C中的字符串文字看起来像
@“this”


因此,将
@Sample-Inner-Age
更改为
@“Sample-Inner-Age”
,例如。

我不确定您从哪里复制了代码;我在Facebook开发者网站上找不到任何关于“内心时代”的引用。您可能误解了如何编辑他们提供的源代码。使用注入数据的正确实现将为字符串文本提供引号(您还缺少描述):

NSMutableDictionary*object=[FBGraphObjectOpenGraphObjectForPostWithType:@“whatsyourinneragefb:Innerage”
标题:@“样本内部年龄”
图片:@“https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"
网址:@“http://samples.ogp.me/578838518886846"

描述:@“我会为“内部年龄”也这样做吗?这现在会产生错误“使用未声明的标识符‘内部年龄’”“是的,就像
@“whatsyourinneragefb:内部年龄”“
。你是从哪里复制的?我强烈建议在问类似这样的问题之前至少阅读objective-c语言的基础知识。我建议阅读以下内容:我在Facebook开发者网站的“我的应用”中访问我的应用,然后打开图形,单击“获取代码”。完全同意
David
如果你不了解基本知识,那么你需要从头开始。永远不要只是复制和粘贴代码,自己把它打印出来,因为这样你就可以了解它的作用,如果代码中有错误,你就可以发现错误。谢谢你的建议David and大力水手-我将来会把它带到船上。我肯定更想知道为什么我把代码放在我的应用程序中,而不是仅仅在那里敲打它。
NSMutableDictionary<FBGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"whatsyourinneragefb:inner_age"
                                    title:@"Sample Inner Age"
                                    image:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"
                                      url:@"http://samples.ogp.me/578838518886846"
                              description:@"<you're missing a description>"];

[FBRequestConnection startForPostWithGraphPath:@"me/objects/whatsyourinneragefb:inner_age"
                               graphObject:object
                         completionHandler:^(FBRequestConnection *connection,
                                             id result,
                                             NSError *error) {
                             // handle the result
                         }];