小编Arp*_*ekh的帖子

核心数据错误:持久存储协调器未获取文件.它是阶段appDelegate.Below粗体阶段有错误.

在我的申请中

我有一个sqlite文件CoreDataBountyHunter.sqlite

我正在使用核心数据对象模型来连接此sqlite文件.

因为它是Basic应用程序,所以在获取数据或实际代码部分之前我遇到了错误.我有错误像持久存储协调器无法连接到文件或模型.

1)访问视图将出现部分NSManagedObjectContext*moc = appDelegate.managedObjectContext.部分来自于它

2)显示文件的一些代码存在

3)然后它转到持久性存储协调器的下面代码,它从中调用管理对象模型的功能,该代码存在于下一个代码中...在if条件下返回到持久协调器后它出现错误并中止所以请救命

-

//1--------
     (NSPersistentStoreCoordinator *)persistentStoreCoordinator
    {
        if (__persistentStoreCoordinator != nil)
        {
            return __persistentStoreCoordinator;
        }

        NSURL *storeURL=[[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataBountyHunter.sqlite"];

        NSLog(@"%@",storeURL);
        NSError *error = nil;
        **__persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
        if (![__persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])**
        {
             Typical reasons for an error here include:
             * The persistent store is not accessible;
             * The schema for the persistent store is incompatible with current managed object model.
             Check the error message to determine what …
Run Code Online (Sandbox Code Playgroud)

iphone xcode cocoa-touch core-data objective-c

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

无法仅在"ios 5.0"中的导航栏上设置图像

在我的通用应用中,

我在导航栏上设置图像...使用**

objective c category...on UINavigationBar

**

代码在iPhone ios 5.0中运行良好 *代码在iPhone/iPad中的ios 4.3中运行良好*

*But not working in **ios 5.0 iPad***





- (void) drawRect:(CGRect)rect 
    {
    UIImage *image;

   image = [UIImage imageNamed: @"Navigation.png"];

    [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];  

      [self setTintColor:[UIColor clearColor]];

      NSLog(@"Draw Rect");

    }
Run Code Online (Sandbox Code Playgroud)

xcode cocoa-touch objective-c ios ios5

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

什么后才触及开始?

在我的iPad应用程序中......

我正在做一些拖动物体的东西....

我的问题是拖动我需要两种方法......

  1. 接触开始了 some stuff1
  2. 感动了 some stuff2

有时会发生用户在触摸后没有移动对象的情况. 所以,somestuff1已经完成了.我需要扭转它..

那么,我该怎么做......

在此输入图像描述

意味着我可以发射任何事件或通知

如果用户开始触摸并且触摸没有结束.

在此输入图像描述

iphone xcode cocoa-touch objective-c ios

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

NSMutableArray:调用方法时的内存管理

在我的iOS应用程序中,我使用的是名为imageMArray的NSMutableArray.我已设置其getter和setter属性并实例化它.

在viewDidLoad中:

imageMArray=[[NSMutableArray alloc] initWithArray:CategoryImages];
imageMArray=[self shuffleOnlyArray:imageMArray];
Run Code Online (Sandbox Code Playgroud)

在ShuffleOnlyArray方法中:

 NSMutableArray *destArray1 = [[NSMutableArray alloc] initWithCapacity: [sourceArray count]] ;
return destArray1;
Run Code Online (Sandbox Code Playgroud)

在shuffle方法:

imageMArray=[[self shuffleOnlyArray:imageMArray] retain];
Run Code Online (Sandbox Code Playgroud)

Shuffle方法中似乎存在内存泄漏.

我应该释放imageMArray还是将其设置为nil?如果它应该被释放,它应该被自动释放吗?

iphone xcode cocoa-touch objective-c ios

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

标签 统计

cocoa-touch ×4

objective-c ×4

xcode ×4

ios ×3

iphone ×3

core-data ×1

ios5 ×1