小编mil*_*lof的帖子

我在单身人士中使用保留或复制吗?

我读到某个地方,在一个对象中使用NSString,必须使用copy而不是retain.有人可以解释这是否正确,为什么?

例如,我的单身人士有以下声明:

#import <foundation/Foundation.h>
@class FaxRecipient;

@interface MyManager : NSObject {
    NSString *subject;
    NSString *reference;
    NSString *coverSheet;
    FaxRecipient *faxRecipient;

}

@property (nonatomic, retain) NSString *test1;
@property (nonatomic, retain) NSString *test2;
@property (nonatomic, retain) NSString *test3;
@property (nonatomic,retain) FaxRecipient *faxRecipient;



+ (id)sharedManager;

@end
Run Code Online (Sandbox Code Playgroud)

iphone ios

8
推荐指数
1
解决办法
561
查看次数

如何在沙盒中获取文档的所有文件名?

我有以下代码:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)

但是我对如何获取所有文件名并将它们分配给数组一无所知?

任何帮助,将不胜感激.

iphone ios

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

将'NSNumber*__ strong'发送到不兼容类型'CLLocationDegrees'(又名'double')的参数

NSNumber * latitude =  [NSNumber numberWithDouble:[[cityDictionary valueForKeyPath:@"coordinates.latitude"]doubleValue]];

      NSNumber * longitude =  [NSNumber numberWithDouble:[[cityDictionary valueForKeyPath:@"coordinates.longitude"]doubleValue]];


    CLLocation *listingLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
Run Code Online (Sandbox Code Playgroud)

我在上面第3行收到以下错误:

Sending 'NSNumber *__strong' to parameter of incompatible type 'CLLocationDegrees' (aka 'double')
Run Code Online (Sandbox Code Playgroud)

我知道这是因为我试图将NSNumber传递到一个预期会有双倍的地方.但由于ARC,铸造不起作用?

cllocation ios

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

BehatContext和MinkContext之间的混淆

我正在尝试在我的Symfony 2.3项目中进行BDD,并且似乎正在努力解决一些不一致问题.

根据我是否使用BehatContext或MinkContext作为FeatureContext类的基类,我得到的结果不同.

如果我使用:

class FeatureContext extends BehatContext 
Run Code Online (Sandbox Code Playgroud)

一切都好.但是,如果我使用:

class FeatureContext extends MinkContext
Run Code Online (Sandbox Code Playgroud)

我得到错误,使得它看起来像MinkContext不喜欢我的正则表达式不再是系统自己生成的.你能帮我理解一下吗

FFFFFFF

(::) failed steps (::)

01. Ambiguous match of "I am on homepage":
    to `/^I am on homepage$/` from Main\ReferralCaptureBundle\Features\Context\FeatureContext::iAmOnHomepage()
    to `/^(?:|I )am on (?:|the )homepage$/` from Behat\MinkExtension\Context\MinkContext::iAmOnHomepage()
    In step `Given I am on homepage'.
    From scenario `Successful registration when user provides all the required info'. # src/Main/ReferralCaptureBundle/Features/registration.feature:12
    Of feature `registration'.                                                        # src/Main/ReferralCaptureBundle/Features/registration.feature

02. Ambiguous match of "I follow "sign up"":
    to `/^I follow "([^"]*)"$/` from …
Run Code Online (Sandbox Code Playgroud)

symfony behat mink goutte

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

我得到错误:不兼容的指针类型初始化'NSMutableArray*'与表达式'NSArray?

NSMutableArray *sortedReleases = [theReleases sortedArrayUsingComparator:^(id a, id b)
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

不兼容的指针类型使用"NSArray*"类型的表达式初始化"NSMutableArray*"

我必须将sortedReleases作为NSMutableArray.我如何通过它?

谢谢

iphone objective-c nsmutablearray ios

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

如何访问NSMutable Array中的自定义对象字段?

我有一个自定义对象,如:

 #import <Foundation/Foundation.h>


    @interface FaxRecipient : NSObject {


        NSString * contactID;
        NSString * name;
        NSString * fax;
        NSString * company;
        NSString * phone;

    }
    @property(nonatomic,retain)NSString *contactID;
    @property(nonatomic,retain)NSString *name;
    @property(nonatomic,retain)NSString *fax;
    @property(nonatomic,retain)NSString *company;
    @property(nonatomic,retain)NSString *phone;

    @end
Run Code Online (Sandbox Code Playgroud)

我有一个包含FaxRecipient对象的NSMutableArray(remoteRecipientItems)数组.

但是,我试图通过使用名称设置UITableView单元格的值:

[[cell textLabel]setText:[remoteRecipientItems objectAtIndex:[indexPath row]]]; //I want to only use the name value of FaxRecipient. Sorry for the newbie question.
Run Code Online (Sandbox Code Playgroud)

iphone ios

0
推荐指数
1
解决办法
82
查看次数

标签 统计

ios ×5

iphone ×4

behat ×1

cllocation ×1

goutte ×1

mink ×1

nsmutablearray ×1

objective-c ×1

symfony ×1