小编mse*_*dio的帖子

CoreData和NSInvalidArgumentException无法识别的选择器发送到实例

在尝试设置我的属性"phoneNumber"时,我一直遇到此异常:

*由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [SearchResult setPhoneNumber:]:无法识别的选择器发送到实例0x256b40'

这是具有phoneNumber属性的类:

@interface SearchResult : NSManagedObject
@property (nonatomic, retain) NSString * phoneNumber;
@end

@implementation SearchResult
@dynamic phoneNumber;
@end
Run Code Online (Sandbox Code Playgroud)

问题是当我这样做时:

SearchResult *managedObject = [self findExistingSearchResultById:restaurantId];

if(managedObject == nil)
{ 
    managedObject = [NSEntityDescription insertNewObjectForEntityForName:@"SearchResult" inManagedObjectContext:managedObjectContext];
}

// Exception throws here.
managedObject.phoneNumber = @"1234567890";
Run Code Online (Sandbox Code Playgroud)

这是findExistingSearchResult方法:

+ (SearchResult *)findExistingSearchResultById:(NSString *)restaurantId
{
    NSManagedObjectContext *managedObjectContext = serviceContext;
    NSFetchRequest *request = [[NSFetchRequest alloc]init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"SearchResult" inManagedObjectContext:managedObjectContext];
    [request setEntity:entity];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"restaurantId = %@", restaurantId];
    [request setPredicate:predicate];

    NSError …
Run Code Online (Sandbox Code Playgroud)

iphone core-data objective-c nsmanagedobject ios5

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

“分页预览”视图模式下的 Excel VSTO 加载项和上下文菜单 idMso

我使用 VSTO 创建了一个 Excel 2010 AddIn。我有一个工作正常的上下文菜单,但是当我切换到 Excel 视图“分页预览”时,我的右键单击上下文菜单不再显示。我需要为分页模式定义不同的 idMso 部分吗?

我目前正在使用:

    <contextMenu idMso="ContextMenuCell">
        <!--buttons here-->
    </contextMenu>
Run Code Online (Sandbox Code Playgroud)

c# vsto visual-studio-2010 excel-interop

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

Grand Central Dispatch EXC_BAD_ACCESS例外

我有一个空块在Xcode的iPhone 6.0模拟器中正常运行,但是当我切换到iPhone 5.1模拟器时,我得到以下异常:"EXC_BAD_ACCESS".

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        // I've removed all code from here and exception still occurs.
    });
Run Code Online (Sandbox Code Playgroud)

有什么想法导致这个?dispatch_async行抛出异常.虽然我使用ARC,但不确定它是否重要.

xcode grand-central-dispatch ios ios5.1

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

dbcontext上的实体框架select子句

是否可以在dbcontext.set上有一个select子句.我有以下代码返回db表中People的所有共存保险并选择所有列.

public IQueryable<Person> GetPeople()
{
    return DbContext.Set<Person>();                
}
Run Code Online (Sandbox Code Playgroud)

我只想选择用户名和电子邮件

c# entity-framework

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

CC.net和GitHub私有存储库

有谁能够弄清楚如何配置ccnet源代码控制设置以连接到私有github存储库?

git msbuild github ccnet-config

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

实体框架和DbContext - 对象跟踪

我对实体框架中DbContext的使用有点困惑.这是我很困惑的情景.

当列表返回这次时,它不反映我在运行update语句时所做的更新/更改,除非我遍历所有事务并重新加载它们:

foreach (DbEntityEntry<Transactions> item in DefaultContext.ChangeTracker.Entries<Transactions>())
{
    DefaultContext.Entry<Transactions>(item.Entity).Reload();
}
Run Code Online (Sandbox Code Playgroud)

这是正常的行为吗?我假设在我的初始查询中,它们被附加到对象上下文.然后当我第二次查询时,它不会访问数据库,只是从对象上下文中提取实体,除非我清除/分离或单独重新加载所有实体.

c# entity-framework .net-4.0 visual-studio-2010 entity-framework-4.1

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

使用加号(+)转换Oracle的连接语法到标准连接语法

我试图理解使用(+)连接两个表的Oracle连接语法.有人可以告诉我,如果它被转换为使用标准连接语法,这个查询将会是什么样子?

select p1.product_id, p1.product_name, p2.product_code, (decode(p3.product_type, null, 'N/A',p3.product_type) as product_type
from products p1, product_descriptions p2, product_descriptions p3
where p1.product_id=p2.product_id
and p2.product_age=p3.product_age(+)
and p2.product_type=p3.product_type(+)
and p3.status(+)='VALID'
Run Code Online (Sandbox Code Playgroud)

sql oracle oracle10g oracle11g

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

Objective-C静态字段问题

我创建了一个从plist文件加载字典项的小类.getSettingForKey方法在我第一次调用静态方法时工作,但是在多次调用之后,字典会为具有在先前调用上工作的相同键的调用抛出SIGABRT异常.有任何想法吗?

static NSDictionary *dictionary = nil;
static NSLock *dictionaryLock;

@implementation ApplicationSettingsHelper

+ (void) initialize
{
    dictionaryLock = [[NSLock alloc] init];

    // Read plist from application bundle.
    NSString *path = [[NSBundle mainBundle] bundlePath];
    NSString *finalPath = [path stringByAppendingPathComponent:@"Xxxx.plist"];
    dictionary = [NSDictionary dictionaryWithContentsOfFile:finalPath];

    // dump the contents of the dictionary to the console.
    for(id key in dictionary)
    {
        NSLog(@"bundle: key=%@, value=%@", key, [dictionary objectForKey:key]);
    }
}

+ (NSDictionary *)dictionaryItems 
{
    [dictionaryLock lock];

    if (dictionary == nil)
    {
        [self initialize];
    }

    [dictionaryLock unlock]; …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

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

PHP IIS 7和FastCGI无法正常工作

我按照这里的指示:使用FastCGI在IIS 7上托管PHP应用程序来配置Windows 2008,PHP与IIS 7和FastCGI,我遇到了问题.PHP版本是5.3.8.我在IIS上设置了Handler Mappings,并创建了一个测试页面,但页面除了500错误外没有返回任何内容.我确保PHP工作,从命令行我输入时得到响应:

php -version.
Run Code Online (Sandbox Code Playgroud)

也就是说,我已经为php页面启用了失败的请求跟踪规则,当我浏览错误日志时,我看到的内容如下:

<EventData>
  <Data Name="ContextId">{00000000-0000-0000-0200-0080010000F6}</Data>
  <Data Name="ModuleName">FastCgiModule</Data>
  <Data Name="Data1">FASTCGI_RESPONSE_ERROR</Data>
  <Data Name="Data2">PHP Warning:  phpinfo() [&lt;a href=&apos;function.phpinfo&apos;&gt;function.phpinfo&lt;/a&gt;]: It is not safe to rely on the system&apos;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &apos;America/New_York&apos; for &apos;-4.0/DST&apos; instead in C:\inetpub\wwwroot\phpinfo.php on line 1
</Data> …
Run Code Online (Sandbox Code Playgroud)

php iis iis-7 fastcgi windows-server-2008-r2

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