Closed rajesht1989 closed 6 years ago
Hi Rajesh, thank you for the heads up!
Could you provide some code snippets or a small test project that fails for you on Xcode 10, please? Can you also open Promises.xcworkspace on your side and confirm all tests pass?
Thanks.
Objc code
[Test callMeObjc].then(^id(NSNumber *number) {
NSLog(@"%@",number);
return nil;
});
Swift class
class Test : NSObject {
static func callMeObjc() - Promise<Bool.ObjCPromise<NSNumber {
return callMe().then({ (value) in
return NSNumber(value: value)
}).asObjCPromise()
}
static func callMe() - Promise<Bool {
return Promise<Bool.init(true)
}
}
This is the simple use case. The application fails to compile.
I m unable test because it throws an error.
Tests in the target “PromisesTests” can’t be run because “PromisesTests” isn’t a member of the active scheme.
Tested Pod with XCode 10 beta with new blank Cocoa app,
result in Swift Compiler Error
> Include of non-modular header inside framework module 'FBLPromises'...
And then open project back in XCode 9 will remain to have this error. Clean project, pod remove and add didnt help.
If creating a blank new project with in XCode 9, it works. But broken once opened it with XCode 10 beta.
@rajesht1989 I just ran the following code successfully in a new 1-view template project set up with Cococapods in Xcode 10 beta:
# Podfile
target 'TestPromisesCocoapods' do
use_frameworks!
pod 'PromisesSwift', '~> 1.2.2'
end
// TestObject.h
#import <FBLPromises/FBLPromises.h>
@interface TestObject : NSObject
- (void)test;
@end
// TestObject.m
#import "TestPromisesCocoapods-Swift.h"
@implementation TestObject
- (void)test {
[Test callMeObjc].then(^id(NSNumber *number) {
NSLog(@"%@",number);
return nil;
});
}
@end
// TestPromisesCocoapods-Bridging-Header.h
#import "TestObject.h"
// ViewController.swift
import Promises
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
TestObject().test()
}
}
// Test.swift
import Promises
class Test : NSObject {
@objc
static func callMeObjc() -> Promise<Bool>.ObjCPromise<NSNumber> {
return callMe().then { value in
NSNumber(value: value)
}.asObjCPromise()
}
static func callMe() -> Promise<Bool> {
return Promise(true)
}
}
Let me know if it works on your side.
@shoumikhin We had the same sort of code but It was not working. Now we are able to fix the issue by making return type FBLPromise
new working code
static func callMeObjc() -> FBLPromise<NSNumber> {
return callMe().asObjCPromise()
}
Instead of
static func callMeObjc() -> Promise<Bool>.ObjCPromise<NSNumber> {
return callMe().asObjCPromise()
}
Can you let me know if this is fine and let me know the causes and consequences of this ?
Do you also have an @objc
specifier for the function returning ObjCPromise
and used from Objective-C?
I'd highly appreciate if you packed a simple test project in zip and attached here, so that we could reproduce your error.
Thanks!
@shoumikhin I have tried giving @objc
specifier but still helpless. When I try the same in the sample project, It compiled without any issues.
So, I feel the problem is in the configuration of my project which I could not identify. :(
Sorry to hear that. Hoped we could help to resolve your issue. Anyhow, feel free to close this issue and follow up with any other related findings in future.
@shoumikhin I'm having the same problem with promises and Xcode 10 beta. Couldn't build FBLPromises: Include non-modular header inside framework module 'FBLPromises'
The project builds fine with Xcode 9.3 :( and I'm using PromisesSwift
This problem is resolved by removing Promises from pod file and reinstall...
@Kishimotovn just to clarify, do you say the issue has gone when you re-run pod update
? Were you able to successfully build Promises with Xcode 10 eventually? Would appreciate any reproduction steps that lead to the issue.
Hi @shoumikhin,
Here is what I did:
It seems that this problem only happens when you open an existing project with xcode 10. Projects that are created with xcode 10 won’t have this problem :-?
Just turn on Xcode Server. It's good for me.
Got that same error under XCode 9.4.1 with version 1.2.3.
Include of non-modular header inside framework module 'FBLPromises'
..../Sources/Promises/Promise+Await.swift:15:8: Could not build Objective-C module 'FBLPromises'
And I tried the remove / reinstall trick but still same problem.
And this is being added to an existing XCode 9 project.
Hi Martin, thank you for reporting that!
Are you using CocoaPods? Wonder if the following would work for you:
pod cache clean PromisesObjC
pod cache clean PromisesSwift
cd <your_project_dir>
rm -rf Pods/
rm Podfile.lock
pod update
Followed instructions... Same issue.
Deployment target : MacOS 10.12 Swift Version : 4.1
Do you mind to make a small test project and check if it reproduces on it, and if so, share the project here with some instructions on how to break it? Many thanks!
Will do and report here.
Weird. I created a new project; installed and compiled the Promises pod without any issues. Will investigate my current project structure.
Here's my latest finding:
Cleaning the project and removing the XCode "DerivedData" folder and then rebuilding works correctly.
However If I clean the project but not do remove the "DerivedData" folder then it fails with the "non-modular error".
Not sure where to go from here.
Thank you for experimenting, Martin! How do you normally clean the project?
There're basically two standard options via Xcode:
Wonder if both of them fail to clean DerivedData
properly?
OK, after some tests, even the Clean Build Folder.... does not prevent the compilation failure. I have to moved the "DerivedData" folder to the trash to allow my project to build cleanly.
Weird !!!
Will have to try with XCode 10 to see if this is a bug that is now resolved...
Getting the same issue. I read somewhere that might be because of low memory. But that doesn't help as well.
I think it's an issue if you have started your project with an earlier version of XCode and then upgraded all the way to XCode 10.
The only way I was able to make this work (even in XCode 10) was to physically delete the DerivedData folder.
On Fri, Oct 12, 2018 at 03:29 nitishmaropost notifications@github.com wrote:
Getting the same issue. I read somewhere that might be because of low memory. But that doesn't help as well.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/promises/issues/49#issuecomment-429232116, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmB8d91iW0XTLgAZAn2zlV6NzrXN8tyks5ukETkgaJpZM4UaVnq .
This randomly happened while adding another library as a pod. Like @martindufort said deleting DerivedData folder fixed it!
There seems to be an issue while converting Promise to FBLPromise. Completly blocked.