草庐IT

login_context

全部标签

ios - 从 Core Data Managed Object Context 中删除插入但未保存的对象

有没有办法删除已插入上下文但尚未保存的单个托管对象?我想删除单个对象,而不是回滚整个上下文。我试过调用deleteObject:但它抛出异常,因为根据核心数据,该对象在MOC中尚不存在。通过查看核心数据的insertedobjects属性,我肯定知道它已被插入,通过查看deleted对象,我知道它已被标记为删除。本质上我想“取消插入”该对象。先保存再删除是NotAcceptable。谢谢。 最佳答案 事实证明,对尚未持久化的对象调用deleteObject:是完全合法的。根据Apple的文档:Ifobjecthasnotyetbee

ios - 来自 API 的 Facebook API : How to get the FB login user's unique ID? ID 与 v2.0 中的 'real' 用户 ID 不匹配

-(void)loginViewFetchedUserInfo:(FBLoginView*)loginViewuser:(id)user{self.profilePictureView.profileID=user.objectID;self.nameLabel.text=user.name;NSLog(@"MyID:%@",user.objectID);}我尝试使用上面的代码打印用户ID。我得到的是3176144783XXXXX。但是,我使用这个在线工具得到了一个不同的工具http://findmyfacebookid.com/.结果是1000042591XXXXX。有人知道区别吗?

iphone - CGContextFillRects : invalid context - Objective C

我有这段代码可以为我的图像提供我需要的颜色:-(UIImage*)convertToMask:(UIImage*)image{UIGraphicsBeginImageContextWithOptions(image.size,NO,image.scale);CGRectimageRect=CGRectMake(0.0f,0.0f,image.size.width,image.size.height);CGContextRefctx=UIGraphicsGetCurrentContext();//Drawawhitebackground(forwhitemask)CGContextSet

xcode - swift 2.0 : Type of expression is ambiguous without more context (Using Parse)

我一直收到错误消息“表达式类型不明确,没有更多上下文”。我的代码如下:funcfetchUnviewedUsers(callback:([User])->()){PFQuery(className:"Action").whereKey("byUser",equalTo:(PFUser.currentUser()?.objectId)!).findObjectsInBackgroundWithBlock{(objects,error)->VoidinletseenIDS=map(objects,{$0.objectForKey("toUser")!})PFUser.query()!.wh

android.content.Context.getPackageName()' 在空对象引用上

我正在使用实现接口(interface)的fragment。publicclassSigninFragmentextendsFragmentimplementsSigninInterfacefragment类中接口(interface)的方法实现如下。@OverridepublicvoidafterSubmitClicked(StringuserId,Bundlebundle){Log.d(TAG,"CallingtimeafterSubmitClickedcalled"+bundle);if(!userId.equals("-1")){//Loggedinsuccessfully//

android.content.Context.getPackageName()' 在空对象引用上

我正在使用实现接口(interface)的fragment。publicclassSigninFragmentextendsFragmentimplementsSigninInterfacefragment类中接口(interface)的方法实现如下。@OverridepublicvoidafterSubmitClicked(StringuserId,Bundlebundle){Log.d(TAG,"CallingtimeafterSubmitClickedcalled"+bundle);if(!userId.equals("-1")){//Loggedinsuccessfully//

ios - Xcode swift : Login/Signup Page not displaying first due to slideoutmenu

我正在使用xcode/swift创建一个应用程序,它实现了侧边栏滑动菜单和登录/注册过程。侧边栏滑动菜单功能只能在完成登录或注册后立即在下一个View中访问。我按照此处的滑动边栏教程的说明进行操作:RayWenderlich-SidebarTutorial问题是->我的边栏菜单功能仅在包含View是打开应用程序时显示的第一个View时才有效。有时这是可以的,因为一旦用户登录,侧边栏菜单View是第一个显示的View——但情况并非总是如此——注销的用户必须先完成注册/登录,然后才能访问/转换到此View。我确实将应用程序的初始View设置为指向Storyboard中的LoginViewC

ios - swift - NSPredicate 和 Context Save 运行不正常

我有一个检查核心数据的功能。如果不存在,它应该写入其中(但它不是那样工作的)SoundItems是一个包含收藏对象的数组,mainArray是包含真实对象的数组;@IBActionfuncFavori(_sender:Any){//savecoredataletapp=UIApplication.shared.delegateas!AppDelegateletcontext=app.persistentContainer.viewContextletnewSound=NSEntityDescription.entity(forEntityName:"Sounds",in:context

Android context.getResources.updateConfiguration() 已弃用

就在最近context.getResources()。updateConfiguration()已在AndroidAPI25中弃用,建议使用上下文。createConfigurationContext()而是。有谁知道如何使用createConfigurationContext来覆盖android系统语言环境?在此之前由以下人员完成:Configurationconfig=getBaseContext().getResources().getConfiguration();config.setLocale(locale);context.getResources().updateCon

Android context.getResources.updateConfiguration() 已弃用

就在最近context.getResources()。updateConfiguration()已在AndroidAPI25中弃用,建议使用上下文。createConfigurationContext()而是。有谁知道如何使用createConfigurationContext来覆盖android系统语言环境?在此之前由以下人员完成:Configurationconfig=getBaseContext().getResources().getConfiguration();config.setLocale(locale);context.getResources().updateCon