Parse API change, PFLogInViewController not found - ios

Getting back to an Objective C project of mine started a while ago , which was compiling fine, I now find myself with a few issues related to Parse pods. Searching the net I already found a few things, but still have some problems (and doubts).
First I got an error message saying that a file was not found on this line:
#import <ParseUI/ParseUI.h>
After reading a few related post, I understood that ParseUI was deprecated and I should use Parse/UI instead in my Podfile, so I changed the line above to:
#import <Parse/Parse.h>
And I also changed in the Podfile:
pod 'ParseUI'
to:
pod 'Parse/UI'
I then reran:
pod install
But I now have these messages showing up:
Cannot find interface declaration for 'PFSignUpViewController', superclass of ....
No type or protocol named 'PFSignUpViewControllerDelegate'
.....
Cannot find interface declaration for 'PFLogInViewController', superclass of ....
along the project.
And I was indeed subclassing PFSignUpViewController as well as PFLogInViewController.
So where did those classes go? Deprecated, different names or what?
Any help would be very much appreciated.
.......
After making a separate new project to check how things work, I found out that I can still use PFLogInViewController. And then looking again on the net for posts about similar issues, I tried to add this line:
#import Parse;
But I get this error:
Module 'Parse' not found
I must be doing something wrong hiding the PFLogInViewController class.

After making a separate small project to isolate the problem, I first hit the same issue. And with a bit more digging I ended up solving it by adding this import:
#import <PFLogInViewController.h>
after the one which was already there:
#import <Parse/Parse.h>
I hope this can help someone else having the same problem at some point.

Related

Xcode 13 Bridging Header does seem to find my Obj-C classes

I know this question might have been posted multiple times, but I haven't find any solution for 2 days despite looking closely all the answers in here.
I have an Objective-C data model I want to use in my Swift application.
So when adding my DataModel.m in my Models folder, it created MyApp-Bridging-Header.h inside the Models folder as well.
I try several things in the Bridging-Header file to import my ProjectModel.h like:
#import "ProjectModel.h"
#import "Models/ProjectModel.h"
#import "MyApp/Models/ProjectModel.h"
But none seems to works as I would like.
The Bridging-Header file is defined as well in the Build Settings (see below)
But as soon as I try to compile the project I keep having the error: Cannot find type 'ProjectModel' in scope (like below)
And when using auto-completion on ProjectModel I got this warning:
I don't know what I am missing right now, I would appreciate any help, plus, I'd rather specify, I am doing this on macOS Monterey with Xcode 13.1.
Add the following line at the beginning of the Swift file that uses the model:
import ProjectModel

Realm.io build errors when using cocoapods `use_frameworks!`

Goal: Be able to use swift pods in an ObjC project
Steps Taken:
Altered Podfile by appending use_frameworks!
Ran pod install (Cocoapods version 1.0.0)
Built workspace again
Result (Errors):
I get the following Realm.io errors (pod installed from pod 'Realm' since I'm coding in ObjC):
RLMRealm.h:51:1: Duplicate interface definition for class 'RLMRealm'
RLMRealm.h:95:62: Property has a previous declaration
RLMRealm.h:105:38: Property has a previous declaration
RLMRealm.h:110:56: Property has a previous declaration
RLMRealm.h:115:38: Property has a previous declaration
RLMRealm.h:297:28: Property has a previous declaration
RLMRealm.h:493:1: Duplicate interface definition for class 'RLMNotificationToken'
Problem-Solving Steps Taken:
(Previous ones in edit history that led to this simplified question)
Deleted all pods and reinstalled (no effect)
Unlinked Pods framework in Build Phases and relinked (no effect)
Cleaned and built / Cleaned build folder and built (no effect)
Tried importing with "", <>, and #import (currently all imports in my code are done with #import <Realm/Realm.h>) (searched with #import <Realm and #import "Realm) (no effect)
Created new project, copied files over, and pod installed (no effect)
Searched project folder for "#interface RLMNotificationToken" and only found one instance of the RLMRealm.h file, so I don't have duplicates
Deleting all of my files except for AppDelegate.h/m builds successfully
Searched for #import "R, #import <R, #import R and found a rogue #import <RLMRealm.h>
Questions:
I'm frankly really confused and not sure what to do at this point.
So how do I fix these build errors? Why is this happening? Or what other problem-solving steps should I try? (Answers to any of these questions would be appreciated)
Evidently one of my files had a #import <RLMRealm.h> in it (not sure how that got in there). I changed that to #import Realm; and it all works now. I missed that when searching before and only found it while combing my code. Interesting that it works with the library but not with the framework. Well, figured it out and it's all good now.
Realm pod for swift is "RealmSwift". I think you are using objective-c pod.
Have a look at this link Realm for Swift. You can also drag and drop realm framework, this will save from errors you have been facing.
Please check all places, where you import Realm classes. In my case I imported #import <RLMArray.h>. Should be #import <Realm/RLMArray.h>

No such module 'Parse' error even after installing the frameworks

I am getting the error 'No such module Parse' even though I have added all of the needed frameworks. I get this error when I try to import Parse at the top of my appdelegate or my viewcontroller.
Here is a screen shot:
I want wasnt able to use the downloadable pro from parse because it was outdated. My goal is to get rid of this error. Please describe your answer because I know that this answer can be complicated do I have to do something in my search paths? Once again here is my error: 'No such module Parse'. Thanks for the help I appreciate it very much you can also download the project at this link: https://www.dropbox.com/sh/wn7wamqdp4ty34h/AADxXGMByvvaUYfzsBZ2Ej1Oa?dl=0
Try to import it in the Bridging-Header.h like:
#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
Create Briding-Header.h
Create a new Objective-C File
Choose Create Bridging Header
You can also try this: terhechtes answer or B Ks answer
How did you import your Parse framework? Manually or through Cocoapods(recommended)? #JulianPomper's advice is correct so long as everything is set up properly, but you don't need to import Bolts.

referring to an installed pod within Prefix.pch

Finally taking on pods. Everything seems to work, for example, dropped in Parse, install pod'd, see it in a view controller.m file just fine.
BUT.. now i want to drop Parse into the pch as i use it so often. My pre-pods line was:
#import "Parse/Parse.h"
I tried this, and
#import <Parse/Parse.h>
and
#import <Parse.h>
.. and every variant i can think of, no luck. I can of course drop imports where required, but this is more convenient, despite the suggestions not to use this route.
What i find most confusing is that the UI pre-fills in the path for me for second option, so it finds it, but on build, it fails with
'Parse/Parse.h' file not found.
Thanks for suggesting a working syntax.
This may not be the perfect answer, as there are so my cocoapods fans using the repo that this is likely due to my newness to it, but i had to manually create an entry into User Header Search Paths which was "Pods" and set it recursive.
Then all was good.

Xcode 6 'Parse Issue, Expected a Type' using cocoapods

Since upgrading to the latest xcode, I'm having issues with certain pods where if I install them and go to import them in my code, the actual pod itself is getting labelled with "Parse Issue, Expected a Type"
I'm hoping someone can help me and tell me if they have either experienced this problem themselves, or if it's a known issues etc. I have attach images of the import in my viewcontrollers, and the error messages from xcode. For this particular example, I create a brand new UIViewControllerClass, and import the classes listed, and then set 2 extra protocols. There is nothing changed in the .m file.
#import <UIKit/UIKit.h>
#import "ABPadLockScreenViewController.h"
#import "ABPadLockScreenSetupViewController.h"
#interface ChangePinViewController : UIViewController <ABPadLockScreenViewControllerDelegate, ABPadLockScreenSetupViewControllerDelegate>
#end
This turned out to be an issue with xcode. Updating to a later version resolved the issue.

Resources