【发布时间】:2017-01-08 17:20:03
【问题描述】:
我有一个在各种设备上运行良好的应用程序,但是当我尝试在模拟器上运行它时出现以下错误。
指向没有明确所有权的非常量类型“id”
我知道应该从哪里删除 id* 中的 * 来解决问题,但是 id* 位于 coreData.h 中,所以我无法更改它。
我怎样才能摆脱这个错误?
在 NSFetchRequest.h 中有一行 id*_additionalPrivateIvars; (这是错误的来源)
它是框架coreDate/coreData.h中的一个头文件
这个框架被导入到我的一个视图控制器中
coreData 中的其他人是 id** _kvcpropertyAccessors;在 NSEntityDescription.h 和 id_optimizationHints;在 NSManagedObjectModel.h 和 id_cachedObsInfoByEntity;和 id*_contextLabel;在 NSManagedObject.h 和 id _additonalPrivateIvars;在 NSPersistentStoreCoordinator.h 内 和 id _oidFactories;在 NSPersistentStore.h 中
不知道这是否有帮助,但是...
所有这些都与将视频上传到 youtube 有关
我没有所有设备,所以我必须在模拟器上运行应用程序,主要是查看不同的视图,以确保一切正常。我不能使用自动调整大小,因为当视图运行时我有各种动画,并且它们必须根据设备定位不同的东西。
任何帮助将不胜感激。
好的,这里是 coreData/NSEntityDescription.h 中上下文中的代码
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSRange.h>
NS_ASSUME_NONNULL_BEGIN
@class NSManagedObjectModel;
@class NSManagedObjectContext;
@class NSManagedObject;
@class NSData;
@class NSPropertyDescription;
@class NSRelationshipDescription;
@class NSAttributeDescription;
// Entities describe the "types" of objects available.
NS_CLASS_AVAILABLE(10_4,3_0)
@interface NSEntityDescription : NSObject <NSCoding, NSCopying, NSFastEnumeration> {
@private
int32_t _cd_rc;
id _snapshotClass;
NSString *_versionHashModifier;
NSData *_versionHash;
__weak NSManagedObjectModel *_model;
NSString *_classNameForEntity;
Class _instanceClass;
NSString *_name;
__weak NSEntityDescription *_rootentity;
__weak NSEntityDescription *_superentity;
NSMutableDictionary *_subentities;
NSMutableDictionary *_properties;
id _propertyMapping;
__strong NSRange *_propertyRanges;
struct __entityDescriptionFlags {
unsigned int _isAbstract:1;
unsigned int _shouldValidateOnSave:1;
unsigned int _isImmutable:1;
unsigned int _isFlattened:1;
unsigned int _skipValidation:1;
unsigned int _hasPropertiesIndexedBySpotlight:1;
unsigned int _hasPropertiesStoredInTruthFile:1;
unsigned int _rangesAreInDataBlob:1;
unsigned int _hasAttributesWithExternalDataReferences:1;
unsigned int _hasNonstandardPrimitiveProperties:2;
unsigned int _hasUniqueProperties:1;
unsigned int _validationUniqueProperties:1;
unsigned int _reservedEntityDescription:19;
} _entityDescriptionFlags;
__strong void *_extraIvars;
NSMutableDictionary *_userInfo;
id _flattenedSubentities;
id** _kvcPropertyAccessors; (THIS IS THE OFFENDING CODE LINE)
long _modelsReferenceIDForEntity;
}
这里是导入 coreData.h 框架的 youTubeConnectViewController.h 页面。 // youTubeConnectViewController.h
// my little world app
//
// Created by Creatucate on 11/25/12.
// Copyright (c) 2012 Creatucate. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GData.h"
#import "GDataYouTubeAccessControl.h"
#import <GoogleSignIn/GoogleSignIn.h>
#import <CoreData/CoreData.h>
#import <Security/Security.h>
#import "SSKeychain.h"
#define devKey @"AIzaSyDrmQGFblRrH0aBTbR7gsMKxl5QMqgTxcc"
@interface youTubeConnectViewController : UIViewController <UITextViewDelegate, UIPickerViewDataSource,UIPickerViewDelegate, UITextFieldDelegate,NSFetchedResultsControllerDelegate,GIDSignInDelegate,GIDSignInUIDelegate>{
IBOutlet UILabel *UserName;
IBOutlet UILabel *commas;
IBOutlet UIButton *signInButton1;
IBOutlet NSTextField *mEntryCountField;*/
IBOutlet UIPickerView *catagoryPicker;
IBOutlet UIProgressView *mUploadProgressIndicator;
IBOutlet UIButton *cancel;
NSDictionary *titleTextAttributes;
IBOutlet UITextField *number;
IBOutlet UILabel *toptitle;
IBOutlet UILabel *movieTitle;
IBOutlet UILabel *descp;
IBOutlet UILabel *tags;
IBOutlet UILabel *catag;
IBOutlet UILabel *account;
IBOutlet UILabel *pub;
IBOutlet UILabel *pubdef;
IBOutlet UILabel *pub1;
IBOutlet UILabel *unlist;
IBOutlet UILabel *unlistdef;
IBOutlet UILabel *unlist1;
IBOutlet UILabel *priv;
IBOutlet UILabel *privdef;
IBOutlet UILabel *priv1;
NSDictionary *pictureDictionary3;
NSDictionary *pictureDictionary4;
NSMutableArray *pickerArray;
IBOutlet UITextField *catagoryField;
IBOutlet UITextField *catagoryField1;
IBOutlet UITextField *ViewingField;
IBOutlet UIImageView *buttonbg;
IBOutlet UIImageView *pickerback;
IBOutlet UILabel *okl;
IBOutlet UIView *SignInButton;
float downloadingstatus;
IBOutlet UITextView* terms;
NSString *authToken;
BOOL mIsPrivate;
BOOL mIsPublic;
IBOutlet UIImageView *signIn;
IBOutlet UIImageView *fail;
IBOutlet UIImageView *signOutView;
IBOutlet UIButton *signIncancel;
IBOutlet UIButton *ok;
IBOutlet UILabel *Password;
IBOutlet UITextField *UserNameField;
IBOutlet UITextField *PasswordField;
IBOutlet UITextField *movieNameField;
IBOutlet UITextField *tagsField;
IBOutlet UITextView *descpView;
IBOutlet UITextField *accountView;
IBOutlet UITextField *UserOutField;
IBOutlet UITextField *PublicField;
IBOutlet UITextField *PrivateField;
IBOutlet UITextField *UnlistedField;
IBOutlet UIButton *chooseButton;
NSMutableDictionary *SignInDictionary;
IBOutlet UITextField *PasswordDisplayField;
IBOutlet UIButton *termsButton;
IBOutlet UIButton *SignOutButton;
IBOutlet UIButton *cancelOutButton;
IBOutlet UIButton *toOutButton;
IBOutlet UITextField *length;
IBOutlet UILabel *authfailed;
IBOutlet UILabel *YouTubesignin;
IBOutlet UILabel *YouTubesignout;
IBOutlet UILabel *YouTubesignoutacc;
IBOutlet UITextView *errorfailed;
IBOutlet UIScrollView *scrollview;
GDataFeedYouTubeVideo *mEntriesFeed; // user feed of album entries
GDataServiceTicket *mEntriesFetchTicket;
NSError *mEntriesFetchError;
NSString *mEntryImageURLString;
GDataServiceTicket *mUploadTicket;
NSURL *mUploadLocationURL;
UIImage *buttonimage3;
}
@property (nonatomic, retain)IBOutlet UILabel *allow;
@property (nonatomic, retain)IBOutlet UILabel *done;
@property (nonatomic, retain)IBOutlet UILabel *tap1;
@property (nonatomic, retain)IBOutlet UILabel *tap2;
@property (nonatomic, retain)IBOutlet UILabel *tap3;
@property (nonatomic, retain)IBOutlet UILabel *tap4;
@property (nonatomic, retain)IBOutlet UILabel *tap5;
@property (nonatomic, retain)IBOutlet UILabel *tap6;
@property (nonatomic, retain)IBOutlet UILabel *tap7;
@property(retain, nonatomic) IBOutlet GIDSignInButton *signInButton;
@property (nonatomic, retain) UIImage *buttonimage3;
- (GDataServiceGoogleYouTube *)youTubeService;
@property (nonatomic, retain) IBOutlet UILabel *commas;
@property (nonatomic, retain) IBOutlet UITextField *length;
@property (readwrite, retain) UIView *inputAccessoryView;
@property (nonatomic, retain) IBOutlet UITextField *catagoryField;
@property (nonatomic, retain) IBOutlet UITextField *catagoryField1;
@property (nonatomic, retain) IBOutlet UITextField *PasswordDisplayField;
@property (nonatomic, retain) IBOutlet UIProgressView *mUploadProgressIndicator;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;
@property (nonatomic, retain) IBOutlet UIImageView *signIn;
@property (nonatomic, retain) IBOutlet UIImageView *signOutView;
@property (nonatomic, retain)IBOutlet UIButton *signIncancel;
@property (nonatomic, retain)IBOutlet UIButton *signInButton1;
@property (nonatomic, retain)IBOutlet UILabel *UserName;
@property (nonatomic, retain)IBOutlet UILabel *Password;
@property (nonatomic, retain)IBOutlet UITextField *UserNameField;
@property (nonatomic, retain)IBOutlet UITextField *PasswordField;
@property (nonatomic, retain)IBOutlet UITextField *movieNameField;
@property (nonatomic, retain)IBOutlet UITextField *tagsField;
@property (nonatomic, retain) NSArray *pickerArray;
@property (nonatomic, retain) IBOutlet UIButton *chooseButton;
@property (nonatomic, retain) IBOutlet UIPickerView *catagoryPicker;
@property (nonatomic, retain) NSMutableDictionary *SignInDictionary;
@property (nonatomic, retain) IBOutlet UITextField *accountView;
@property (nonatomic, retain) IBOutlet UITextField *UserOutField;
@property (nonatomic, retain) IBOutlet UITextField *ViewingField;
@property (nonatomic, retain) IBOutlet UITextField *PublicField;
@property (nonatomic, retain) IBOutlet UITextField *PrivateField;
@property (nonatomic, retain) IBOutlet UITextField *UnlistedField;
@property (nonatomic, retain) IBOutlet UIImageView *buttonbg;
@property (nonatomic, retain) IBOutlet UIImageView *pickerback;
@property (nonatomic, retain) IBOutlet UILabel *okl;
@property (nonatomic, retain) IBOutlet UIImageView *fail;
@property (nonatomic, retain) IBOutlet UIButton *ok;
@property (nonatomic, retain) IBOutlet UITextView* terms;
-(IBAction)failure:(id)sender;
-(IBAction)cancel:(id)sender;
-(IBAction)cancelSignIn:(id)sender;
-(IBAction)hideUserName:(id)sender;
-(IBAction)hidePassword:(id)sender;
-(IBAction)hideTitle:(id)sender;
-(void)textViewDidBeginEditing:(id)sender;
-(IBAction)displayPicker:(id)sender;
-(IBAction)dismissPicker:(id)sender;
-(IBAction)showTerms:(id)sender;
-(IBAction)signOut:(id)sender;
-(IBAction)CancelOut:(id)sender;
-(IBAction)ToOut:(id)sender;
-(IBAction)Public:(id)sender;
-(IBAction)Private:(id)sender;
-(IBAction)Unlisted:(id)sender;
-(IBAction)textFieldReturn:(id)sender;
@property (nonatomic, retain)IBOutlet UIButton *SignOutButton;
@property (nonatomic, retain)IBOutlet UIButton *cancelOutButton;
@property (nonatomic, retain)IBOutlet UIButton *toOutButton;
@property (nonatomic, retain)IBOutlet UIButton *termsButton;
@property (nonatomic, retain)IBOutlet UILabel *toptitle;
@property (nonatomic, retain)IBOutlet UILabel *movieTitle;
@property (nonatomic, retain)IBOutlet UILabel *descp;
@property (nonatomic, retain)IBOutlet UILabel *tags;
@property (nonatomic, retain)IBOutlet UILabel *catag;
@property (nonatomic, retain)IBOutlet UILabel *account;
@property (nonatomic, retain)IBOutlet UILabel *pub;
@property (nonatomic, retain)IBOutlet UILabel *pub1;
@property (nonatomic, retain)IBOutlet UILabel *unlist;
@property (nonatomic, retain)IBOutlet UILabel *unlist1;
@property (nonatomic, retain)IBOutlet UILabel *priv;
@property (nonatomic, retain)IBOutlet UILabel *priv1;
@property (nonatomic, retain)IBOutlet UILabel *pubdef;
@property (nonatomic, retain)IBOutlet UILabel *unlistdef;
@property (nonatomic, retain)IBOutlet UILabel *privdef;
@property (nonatomic, retain)NSDictionary *pictureDictionary3;
@property (nonatomic, retain)NSDictionary *pictureDictionary4;
@property (nonatomic, retain)IBOutlet UIButton *cancel;
@property (nonatomic, retain) IBOutlet UITextField *number;
@property (nonatomic, copy) NSDictionary *titleTextAttributes;
@property(nonatomic, assign) UIModalTransitionStyle modalTransitionStyle;
@property (nonatomic, retain) IBOutlet UILabel *authfailed;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignin;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignout;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignoutacc;
@property (nonatomic, retain) IBOutlet UITextView *errorfailed;
-(IBAction)publish:(id)sender;
-(IBAction)SignInSave:(id)sender;
这是一个例子。很抱歉有这么多代码,但我想我应该包含所有内容供您查看
【问题讨论】:
-
您应该显示您的源代码和系统标头中的违规行。简单地删除
*很少是正确的 - 它意味着什么。您看到的错误与 ARC 有关,知道正确的所有权对于 ARC 的工作至关重要。您可以编辑您的问题以添加额外信息。 HTH -
鉴于每个 iOS 开发人员都有相同的标头,但没有其他人报告此问题,因此您的项目中存在一些导致错误的原因。您需要提供更多上下文。
-
所以我将框架搜索路径从标准更改为 FacebookSDK,现在我可以毫无错误地导入 coreData/coreData.h 但是现在我有关于链接器命令的错误,并且找不到架构的符号i386 主要与 GoogleSignIn 和 Facebook 有关。我将为此发布单独的问题。
标签: ios objective-c core-data ios-simulator xcode7