小编Neo*_*o42的帖子

错误:带有'retain'属性的属性'myBoolVariableName'必须是对象类型

我的.h文件中的@interface定义中有一个BOOL值.它在下面.它是否是一个指针也有同样的问题.

@interface myCustomViewController : UIViewController <UIWebViewDelegate> {
{
 //...more iboutlets defined above
 BOOL *myBoolVariableName;
}
Run Code Online (Sandbox Code Playgroud)

当我编译时,我得到"错误:属性'myBoolVariableName','retain'属性必须是对象类型",用于导入我的.h文件.

我在这里找到了一个关于整数/ nsnumber的页面:

http://discussions.apple.com/thread.jspa?threadID=1846927

所以,似乎我不能在@interface定义中使用BOOL值.我可以用什么呢?

我应该怎么做BOOL /布尔值?

iphone boolean objective-c

12
推荐指数
1
解决办法
1万
查看次数

如何检测和编程为iPhone摇晃

我正试图在这个页面上实现摇动"教程",但我想我错过了一些东西.我将他的加速计功能复制到myAppViewController.m文件中并在其中放入一些nslog,以查看当我使用模拟器"摇动"功能时它是否进入该功能.调试控制台中没有显示任何内容.

http://mithin.in/2009/07/28/detecting-a-shake-using-iphone-sdk

任何人都可以解释我可能会缺少什么?还是指点教程?

我发现这看起来很有希望,但我不知道如何"把它放在一个UIView" 我如何检测有人摇动iPhone?


编辑 - 现在这是我的工作代码,因为接受了答案的建议.

这是我在3.0 iphone sdk中检测摇动手势的代码.

-(BOOL)canBecomeFirstResponder {
    return YES;
}

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self becomeFirstResponder];
}

- (void)viewWillDisappear:(BOOL)animated {
    [self resignFirstResponder];
    [super viewWillDisappear:animated];
}


- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    NSLog(@"{motion ended event ");

    if (motion == UIEventSubtypeMotionShake) {
        NSLog(@"{shaken state ");

    }
    else {
        NSLog(@"{not shaken state ");       
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone delegates shake iphone-sdk-3.0

6
推荐指数
2
解决办法
8936
查看次数

ApplicationUser - 我该如何使用它?我需要在我的使用条款中加入什么?

我试图按照本教程,但我陷入了尝试添加基于ApplicationUser的代码的区域.角色部分.

dotnet将基于db的MVC站点部署到azure

我确实包括这些行:

    using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
Run Code Online (Sandbox Code Playgroud)

我的编译错误

Error 1 The type or namespace name 'ApplicationUser' could not be found (are you missing a using directive or an assembly reference?) c:\users\blah\documents\visual studio 2013\Projects\blah\blah\Migrations\Configuration.cs 96 38 blah

编辑:这是整个代码片段:

 bool AddUserAndRole(ContactManager.Models.ApplicationDbContext context)
 {
    IdentityResult ir;
    var rm = new RoleManager<IdentityRole>
        (new RoleStore<IdentityRole>(context));
    ir = rm.Create(new IdentityRole("canEdit"));
    var um = new UserManager<ApplicationUser>(
        new UserStore<ApplicationUser>(context));
    var user = new ApplicationUser()
    {
       UserName = "user1",
    };
    ir = um.Create(user, "Passw0rd1");
    if (ir.Succeeded == false)
       return …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc entity-framework azure

6
推荐指数
1
解决办法
1万
查看次数

如何在 Apple Watch iOS 中获得 currentStandHour 值?

我想检索指示用户是否站在这个小时的值。我还希望能够检索当天的StandHours计数。

以下是我一直试图理解的 Apple 链接,以便从HealthKit 中获取价值。我提供这些链接是为了帮助理解我在寻找什么,并帮助您回答我的问题。

布鲁诺的回答只是答案的一半。例如,他的standUnit变量是他如何提取用户今天站立的小时数。我测试了它。此外,我假设它必须从 summaries 变量的范围内拉出。

我在 StackOverflow 上发现了另一个问题,可能会提供一些线索。我认为他们设法通过以下方式获得了价值HKCategoryTypeIdentifierWatch os 2.0 beta: access heart beat rate

据我所知,这是我尝试的代码:

import UIKit
import HealthKit
import HealthKitUI

class ViewController: UIViewController {

let hkStoreOnVC : HKHealthStore = HKHealthStore()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    authorizeHealthKit()
    hkTest()
    hkTest2() …
Run Code Online (Sandbox Code Playgroud)

swift healthkit apple-watch

5
推荐指数
1
解决办法
1571
查看次数

有人可以发布NSNumber的完整示例用法吗?

我甚至不确定,例如,我是否可以像普通变量一样使用它.似乎没有可变版本.并且可变意味着它的价值可以改变吗?

iphone xcode nsnumber iphone-sdk-3.0

4
推荐指数
1
解决办法
9497
查看次数

什么版本的safari是iphone操作系统使用的?(截至2009年12月14日)

现在iphone上有哪个版本的Safari?是Safari 4吗?Safari 3?2?介于两者之间?换句话说,当我为iphone编写代码时,用于pc/mac的哪个版本的Safari将是最准确的版本来测试它?

我想我已经遇到过这样的情况:在iphone上处理canvas标签的方式与在safari 4中的处理方式不同.(特别是fillText javascript cmd似乎不起作用).

html iphone safari canvas

4
推荐指数
1
解决办法
3万
查看次数

我可以在我的html文件中放置什么元标记,以便它自动在Microsoft Word中打开该页面?

我的问题与此有关:

有没有办法动态生成word文档而无需在机器上有文字

然而,我的同事告诉我,你可以在你的html head部分中放置一些meta标签,它们将重定向html并使word打开html页面作为word文档.我在框架3.5 aspx页面中尝试过它,但它没有用.

以下是他建议的内容:

<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 11 (filtered)">
Run Code Online (Sandbox Code Playgroud)

我将尝试不同的asp框架,看看是否有帮助.

如果还不清楚的话.浏览器将连接到此asp页面,但随后会看到这些标签并将内容重定向到MS word.

html asp.net ms-word http-headers

1
推荐指数
2
解决办法
1050
查看次数