Parse-sdk-ios-osx: Type arguments cannot be applied to non-parameterized class 'BFTask'

Created on 20 Sep 2015  路  50Comments  路  Source: parse-community/Parse-SDK-iOS-OSX

I just opened my Xcode file to be greeted by 20+ different errors messages all saying the exact same thing:

Type arguments cannot be applied to non-parameterized class 'BFTask'

The errors are split up between PFObjects.h and PFAnalytics.h

The last time I opened this file, I was able to build it perfectly, without any errors. The only thing I have done new since the time I have opened this file is install mongodb (which prompted an update to some XCode command line components) and yeoman on my mac, but I haven't made a single change to the source code for this app, only now I am getting all these errors.

Here are the Parse Libraries I am using:

Using Bolts (1.2.2)
Using Facebook-iOS-SDK (3.24.0)
Using Parse 1.8.5
Using ParseCrashReporting 1.8.5
Using ParseFacebookUtils 1.8.5
Using ParseUI (1.1.6)

I tried cleaning the project a few times, that didn't help.

20+ : There could have been more than 20 errors. After the 20 errors were reported, XCode said: _Too many errors emitted, stopping now_

Needs More Info

Most helpful comment

I removed Facebook SDK from the "Build Settings / Framework Search Path" and it resolved the issue
Probable Framework search paths have priority agains cocoa pods. Thanks nlutsenko!

All 50 comments

Someone posted the same issue on Stack Overflow

The only reason we've seen this happening - is due to old (maybe somehow cached) version of Bolts.framework and it's headers.
I would suggest cleaning Xcode derived data, as well as any build artifacts that might be contained in your project folder. A good way to figure out whether you are using an old version is by looking at BoltsVersion.h header. It should say at least 1.2.2 at this point.

Let us know if this works and feel free to reopen this issue if it doesn't.

@nlutsenko, I wasn't able to get your suggestions to work. The Bolts Version is 1.2.2, and I cleared out my entire build directory (to remove any possible caching), I cleaned my project numerous times, and I removed/reinstalled all of my project dependencies numerous times via cocoapods, and I performed each of these steps multiple times in different orders. The result is the same each time, I get the same 20+ error messages.

I vote to reopen the issue. My project was complete before these errors started happening, and now I can't even compile my app for testing or archive it for the App Store.

I appreciate the help.

Sounds pretty sad.
Allso, which version of Xcode are you using?
I want to help you as much as possible, but since I can't reproduce the issue - I am not sure what would be the best way to do so...
Any chance you can attach a simple repro project here?

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

  • Documentation: https://www.parse.com/docs
  • Google Groups: https://groups.google.com/forum/#!forum/parse-developers
  • Stack Overflow: http://stackoverflow.com/tags/parse.com

@nlutsenko, thanks for your willingness to help. I am using XCode Version 7.0 (7A220). I will get a repo version online for you to take a look at. Thanks again.

Sounds great! Looking forward to see the repro!

Any improvement on this issue ?
I faced the same problem after installing Xcode 7 and moving to swift 2 with the last release of Parse.
I have got about 20 errors like :
error: type arguments cannot be applied to non-parameterized class 'BFTask'

  • (BFTask PF_GENERIC(NSNumber _)_)trackAppOpenedWithLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;

I already tried to :
-clean the project
-erased deviated data
-remove and add Parse once again from the last delivery

I am not having any improvement, and neither is the person who originally posted the problem to Stack Overflow.

Yesterday I set out to create a repo version of the project, so that I could share the problematic version with the Parse team, but in doing so, I was unable to reproduce the issue.

However, I am noticing that the people who have this problem have something in common: we all updated something in our project before the errors started. For example:

Stack Overflow User: Updated to iOS9
Radiovisual (Me): Updated to XCode 7
Gpy1123: Updated to Xcode 7

Yesterday, when I was trying to strip my project down of anything private (my contract won't allow me to disclose any project details), I made a series of steps that eventually made the error go away, however, these steps also left me with an unusable project, but perhaps there is a clue hiding in the steps I took that might help us uncover the cause.

To be clear, I took these steps while STARTING from a copy of the XCode project that was giving me errors, and then worked my way backwards until I could eventually compile the app without the errors:

  1. I deleted all of my project source code, only leaving the AppDelegate.
  2. Inside the AppDelegate, I am initializing Parse.
  3. I renamed my entire application.
  4. I changed the location of the Prefix.pch
  5. I deleted / reimported one of the TwitterFrameworks I am using.
  6. I targeted the simulator instead of my iPhone device.
  7. I deleted all images and app icons.
  8. I deleted all unused directories in my project folder.
  9. Naturally, I continually cleaned the project and the build folder throughout.

And magically, somewhere within those steps, the errors went away.

@nlutsenko, this is why it has been difficult to reproduce the issue, because a new XCode project does not not exhibit the same behaviors, and trying to strip my Project down to a repo version also makes the problem go away (although it leaves me with an unusable app). It seems that updating something in XCode is what triggers this issue. Reading about the problems in Issue #270, it seems that a similar issue happened after an update to XCode 7 (Beta) as well.

I will keep investigating. I really need to get this fixed.

Same issue for me with Parse 1.8.5, but it work with an older version of Parse SDK (1.7.5)

@notiles did you update your version of XCode before you started getting this error, or did you just update your version of Parse from 1.7.5 to 1.8.5? Are you using Cocoapods?

Would anyone be willing to share their project with us that has the issue reproduced?
The issue looks to be purely with using old Bolts (the one that doesn't have generic support) and the latest Parse.

Hello,
I had the exact same issue after updating the parse pod to 1.8.5. Bolts was already 1.2.2.
I was already using Xcode 7 for a couple of days.
This is the result of my pod update:
Using Bolts (1.2.2)
Installing Parse 1.8.5 (was 1.8.3)
Installing ParseCrashReporting 1.8.5 (was 1.8.3)
Installing ParseFacebookUtilsV4 1.8.5 (was 1.8.3)

To make this particular compilation errors go away ( I still have a compilation error) I had to execute a git clean -xffd.

But I'm still unable to build the project, now I'm getting this error:
Pods/Headers/Build/Parse/Parse.h:28:9: fatal error: 'Parse/PFUserAuthenticationDelegate.h' file not found

This is very sad. The project was perfectly working before I decided to update my pods. Does anyone have an idea how to solve this?

@RicardoKoch . We are working on it. I am also stuck without the ability to compile an app that worked perfectly (and ready to be published to the App Store) before I updated my XCode and dependencies. Now this error is preventing me from compiling, or archiving. I can't try the git clean -xffd trick because I am not using git on this project.

One quick suggestion - delete Pods folder from you project and run pod update again.

@radiovisual I update Xcode to 7, then I update Parse...

@nlutsenko , I just tried your suggestion and I am still getting the same errors. It was a good suggestion though.

I also tried opening the same XCode project on another machine running XCode 7, just to rule out the possibility that it is an environment issue, but I got the same exact set of errors when I opened the project on a different machine.

@radiovisual can you please share the project with us or just with me ([email protected])? It would be a tremendous help.

@nlutsenko , ok, I can try to strip the project down of anything sensitive so I can honor my contract, but still get you what you need to take a look at what is happening. I will get back to you soon once I have a version of the project that I can share. Thanks for working with us on this.

Sounds great. Looking forward to see it.

@nlutsenko , I emailed you an Xcode project that should display these 20+ error messages. I hope it can be useful for you. Let me know if you have any questions.

When you open the Xcode project and attempt to compile, you _should_ see the following errors:

screen shot 2015-09-23 at 11 04 04 pm

I'm also having this issue. The problem started when I upgraded from 1.8.3 to 1.8.5. I roll back to 1.8.3 and it works just fine.

@radiovisual You have an extra checkout of Bolts.framework (quite an outdated one) inside
bftaskissue/BFTaskIssue/lib/FacebookSDK/Bolts.framework
Just delete it and everything going to work fabulously (just tested with the project you sent me).

For everyone on this thread:
Guys, please double check that you don't have duplicate checkouts of Bolts.framework.
It's crucial and important, since new headers for BFTask has a class declaration with a generic type aka
@interface BFTask BF_GENERIC(__covariant BFGenericType) : NSObject
The old one won't have it - which causes this problem.

@nlutsenko , nice find! So the FacebookSDK was loading the Bolts.framework, and the 'Facebook-iOS-SDK' (via Cocoapods) also loads in the Bolts.framework and that was causing a dependency collision. That would have been incredibly difficult to find for those of us who used Facebook's recommend installation step (to let the SDK sit somewhere on your harddrive so that you can share it as a dependency with multiple projects from one location), because that usually means you download the SDK and forget about it other than linking to it from within your info.plist.

Anyway, your suggestion helped me get one step closer, since I was able to compile the app (nice!) however I am still getting warnings and complaints of the BFTask variety:

the very first time I tried to compile, the compile was successful, but I got this run-time error after the first successful compile: (Update: I haven't seen this error on my following compile attempts):

1

and here are the warnings I am getting, these warnings I get 100% of the time and they haven't gone away:

screen shot 2015-09-24 at 2 01 32 am

The warnings say:

Conflicting return type in implementation of 'loadObjects': 'BFTask * _Nonnull' vs 'void _Nonnull'

I am getting a lot more BFTask-related warnings, but just a few are shown in the screenshot above.

After I deleted the outdated Bolts.framework, I cleaned my project, I cleaned my build folder, and I deleted all derived data. Then I deleted my Pods directory and ran pod update (which bumped my Bolts version to 1.3.0), but I am still getting BFTask-related warnings.

Update: I think I found the source of the warnings. I had my own implementation of loadObjects and loadObjects:clear based on methods in the older version of PFQueryCollectionViewController, and the old version returned void, whereas the new version returns an instance of BFTask. With some quick refactoring I should be able to make these warnings go away. So I am confident that this will be end of all these BFTask headaches, because these new warnings are unrelated to the original issue (but are still present because of an update to the Parse/ParseUI framework).

Thank you very much Nikita! You saved the day! :+1: :smile: :beer:

Woohoo!
Glad I could help!

I am going to keep this issue open for a little bit so people can find the resolution here, as well as if someone has the same problem - we can follow up.

And as always, let me know if there is anything I can help you with, whether it's this issue or something else.

I really appreciate the help. My app was locked until we found a solution. Now I hope the others who were experiencing this same issue can solve their problem by simply locating and deleting the duplicate and out-dated version of the Bolts.framework . Thanks again!

Hi all -- thanks for help and hints! We were ran into a similar issue after upgrading xcode 7. We were able to fix by modifying the return value in several of the BFTask header files. Below is an example of a modifications :

-+ (BFTask PF_GENERIC(NSNumber _)_)trackAppOpenedWithLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;

++ (BFTask *)trackAppOpenedWithLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;

I'm not too familiar with what that change did, but my guess would be that it generalizes the return type of these methods. Could anyone let me know if I'm on the right track with that guess?

Hope this helps and good luck!

You can do it this way, but you are loosing generic support as well as compiler guarantees that we found super helpful.
As we go further - changing these signatures yourself every time there is a new version of the framework seems fragile and doesn't fix the source problem that you have a reference to old Bolts.framework somewhere in your project.

@nlutsenko Thanks, that's what I figured and I really appreciate the explanation! I agree with you that it seems the source is the old reference somewhere, but can't seem to find it -- any hints (besides the above ones) on how we might do that, especially with regards to where the old references are? The strange part (to me) is that this occurred after upgrading to xCode 7, not a Parse upgrade (though our initial fix was to trying upgrading Parse).

Thanks again, really appreciate it

General way to find it:

  • Cmd + Click on a BFTask in the header that gives you an error
  • Right click anywhere in that file (without selecting text)
  • Select Show in Finder
  • It should open the containing directory in Finder
  • Double check that the location of the files are correct and it is something that you wanted

Trying everything possible after upgrading to Xcode 7, Parse 1.8.5 + Bolts 1.3.0 DIDN'T WORK!
Thanks to @bmurmistro downgrading Parse to 1.8.3, BUILD SUCCEEDED!! Woohoo..

After I did this, it's all working:

  1. Delete pod folder.
  2. Delete any Bolt/Facebook/Parse framework folder in the project.
  3. Do a clean pod update from the project.

Also, the working version is:
Installing Bolts (1.3.0)
Installing FBSDKCoreKit (4.6.0)
Installing FBSDKLoginKit (4.6.0)
Installing FBSDKShareKit (4.6.0)
Installing Parse (1.8.5)
Installing ParseFacebookUtilsV4 (1.8.5)
Installing ParseTwitterUtils (1.8.5)
Installing ParseUI (1.1.6)

Thanks a lot.

I have the exact same configuration than you @crystal520 (except ParseUI)
However it didn't work for me.
I also tried git clean -xffd
I removed every single file containing Bolt or BF

Still have the issue :(

One of the things that surfaced recently - FacebookSDK by default installs itself in ~/Documents/FacebookSDK. it also depends on Bolts in few places, so Bolts.framework is going to be in that direction if you installed FacebookSDK.

As a result - if you have that folder in Framework Search Paths in your target build settings - when compiling Xcode might be using an old version of Bolts.framework.

I removed it, even if I migrated to FBSDKCoreKit through cocoapods and it worked!!!!
Thanks a lot @nlutsenko

Same problem, had neglected ~/Documents/FacebookSDK, now working great. Thanks @nlutsenko

Hey guys, just pinging you here...
Anyone else running into this issue? Or it's safe to close at this point?

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.

Thank goodness, @nlutsenko resolved it by mentioning where the FacebookSDK places itself in the documents folder. Thank you sir!!!

I'm glad we spent half our life fixing this.

I am having this issue now in PFFacebookUtilsV4. Am using latest version of Xcode. Using cocoa pods to install FBSDKCoreKit, ParseFacebookUtilsV4. I have deleted older versions of Bolts from Documents folder. Removed pods and installed again more than two times.

pod 'Mixpanel'
pod 'Parse'
pod 'FBSDKCoreKit'
pod 'ParseFacebookUtilsV4'

The only way I was able to fix it was to create a new project from scratch and import all the project files and install all the pods. That fixed it.

I'm having the same issue. After resolving the initial errors, I am now having issues with PFFacebookUtilsV4.

@class BFTask PF_GENERIC(__covariant BFGenericType); // is having error "expected ; after class"

For some reason it can't find BFTask. Bolts v 1.6.0 is installed.

Hey guys, just wanted to post an update for everyone here:
These errors are going to be resolved if you use the latest version of Parse (which is 1.12.0 at this point).
We removed a requirement for PF_GENERIC and that type at all, but in order to use it - you explicitly need the latest version of Parse.

Well if you don't supply a version for PFFacebookUtilsV4 it installs 1.9.1. If I explicitly use 1.11 in my Podfile it resolves the errors.

pod 'Parse'
pod 'ParseTwitterUtils'
pod 'ParseFacebookUtilsV4', '1.11.0'
pod 'ParseUI'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'

I removed Facebook SDK from the "Build Settings / Framework Search Path" and it resolved the issue
Probable Framework search paths have priority agains cocoa pods. Thanks nlutsenko!

Was this page helpful?
0 / 5 - 0 ratings