【问题标题】:errors while using shareKit on iPhone application?在 iPhone 应用程序上使用 shareKit 时出错?
【发布时间】:2012-04-10 14:10:42
【问题描述】:

最近我使用 shareKIt 在我的 iPhone 应用程序上开发共享属性,并按照他们的指示添加了所需的框架,但是在运行它们时没有错误,而是数字或编译器警告。同样,当我从操作表中单击 Facebook/Twitter 时,应用程序会卡住并崩溃..

我在 SHKActionSheet.m 上遇到错误,说 badAccess

- (void)dealloc
{
[item release];
[sharers release];
[super dealloc];
}

和编译器警告

SHKActionSheet *as = [[SHKActionSheet alloc] initWithTitle:SHKLocalizedString(@"Share")
                                                      delegate:self
                                             cancelButtonTitle:nil
                                    destructiveButtonTitle:nil
                                         otherButtonTitles:nil];

incomplete pointer type sending "Class" to parameter of type 'id< UIActionSheetDelegate >'

需要一些帮助,否则他们还有其他方式来实现共享属性吗?

【问题讨论】:

  • 我认为我们需要查看更多代码才能正确调试它。但是,我认为您的第二个问题是您将 self 作为委托传递给 SHKActionSheet 但 SHKActionSheet 期望一个符合 UIActionSheetDelegate 协议的对象。尝试将 UIActionSheetDelegate 协议添加到您的接口定义中。
  • @parth 是的,这清除了警告.. 谢谢

标签: iphone sharekit


【解决方案1】:

你使用了错误的 SHKActionSheet 的 alloc 方法,使用下面的代码。

SHKItem *item = [SHKItem text:@"test"];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

[actionSheet showFromRect:CGRectMake(0, 0, 320, 250) inView:self.view animated:YES];

【讨论】:

  • 是的,现在操作表工作正常,让您重播.. 但我仍然有一些问题,取消按钮不起作用.. 我的意思是如果我选择了 twitter/more 选项一个模态视图在导航栏的左上方显示为取消按钮。不起作用,仅在模拟器上进行了测试...,这可以在真实设备上使用吗?否则我在哪里更改代码以工作..我还没有找到路径,谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-24
  • 2014-05-28
  • 2021-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-19
相关资源
最近更新 更多