Warnings on XCAbstractTest.h, XCTestCase.h, and XCTestSuite.h - objective-c

I recently turned on stricter warnings for a project, and Xcode started throwing warnings on some of Apple's classes. I'm not sure if this is an Apple bug, or if I'm doing something wrong. I'm using Xcode 6.1.1 on Yosemite.
TL;DR: adding some strict warning flags to your project starts throwing warnings in various XC*Test*.h headers. The issue is intermittent, but the steps below have reproduced the issue on multiple computers.
Steps to reproduce:
Create a new Xcode project via File → New → Project.
Choose iOS → Application → Single View Application.
For Product Name, type MyApp. Choose Objective-C and Universal. Save the project.
Build the project with CommandB. Run the tests with CommandU. Observe that they both finish with no errors or warnings.
Click on the Project to go to the Project Settings.
Click on the blue MyApp Project (as opposed to MyApp or MyAppTests targets).
Click on the Build Settings tab.
Search for Other Warning Flags.
Enter the following string for the Other Warning Flags for the app:
-Weverything -Wno-objc-missing-property-synthesis -Wno-objc-property-synthesis -Wno-direct-ivar-access -Wno-assign-enum -Wno-float-equal -Wno-sign-compare -Wno-switch-enum -Wno-gnu -Wnewline-eof
Build the app again. You should see three or four warnings about treating #import as #import, which is expected given the warnings you just enabled.
Clean the project with CommandShiftK
Build again. You may see extra warnings. If not, then you need to…
Delete the DerivedData folder, at least for this project. It is located at /Library/Developer/Xcode/DerivedData/MyApp-*, where * is some random identifier string. You may also need to delete /Library/Developer/Xcode/DerivedData/ModuleCache.
Clean and build again. And again. It may take a few times. Eventually...
You will see code and documentation warnings on XCAbstractTest.h, XCTestCase.h, and XCTestSuite.h. Screenshot:
As you can see, these warnings would be quite valid on my own code, but this is Apple’s framework code. Is there any way to stop these weirdly intermittent warnings from appearing? Or is it an Apple bug that the file gets warnings at all? I’m leaning Apple bug, because plenty of other Apple headers use #import instead of #import, and none of them is throwing warnings.
Update: I filed a radar: http://www.openradar.me/20038246
Update 2: I was able to glean some more information that may be helpful:
The issue appears to be at least partly related to where Derived Data is stored. See this screen recording, courtesy of Sam Marshall for details: http://cl.samdmarshall.com/a4Hy
Note that, when I reproduce the same steps as in Sam's video on my computer, I am not able to get rid of the extra warnings. They always come back. Possible differences between my and Sam's setups:
Sam is on Xcode 6.1, while I am on 6.1.1.
Sam is on Mavericks, while I am on Yosemite (10.10.2).
When I build in Xcode 6.3b2, I get an additional warning about "building module 'UIKit'". See screenshot: http://cl.ly/a3sK
Update 4: Radar was closed as a duplicate of an issue.
Update 5: I have a workaround, which is to disable the problem warnings on the Tests target only. Here’s a partial diff. Xcode won’t add the $(inherited) automatically, so you’ll have to add it yourself.
+ WARNING_CFLAGS = (
+ "$(inherited)",
+ "-Wno-documentation-unknown-command",
+ "-Wno-auto-import",
+ "-Wno-incomplete-module",
+ );

Related

Kotlin Multiplatform issue : Type 'org.gradle.api.tasks.Copy' property 'sign' doesn't have a configured value

I am trying to build a KMM project everything works fine in Android also in iOS simulator but when I connect an iOS device I get the below error .
FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ':shared:embedAndSignAppleFrameworkForXcode' (type 'Copy').
Type 'org.gradle.api.tasks.Copy' property 'sign' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
Assign a value to 'sign'.
Mark property 'sign' as optional.
Please refer to https://docs.gradle.org/7.4.1/userguide/validation_problems.html#value_not_set for more details about this problem.
My gradle wrapper properties has 7.4.1, I have used 7.2 version as well same issue.
If anyone can tell me how to resolve this gradle issue to get the framework library ready for iOS project it will be very helpful thanks.
Meanwhile I ll try to figure out myself will update if I find any solution.
Looks like you are missing EXPANDED_CODE_SIGN_IDENTITY. Xcode sets this variable if you select an iOS device. For a simulator In my case, it sets it to -.
Kotlin multiplatform plugin requires this variable to be set for embedAndSignAppleFrameworkForXcode to work properly here.
I think updating Xcode may help. alternatively, you can set EXPANDED_CODE_SIGN_IDENTITY to - if it is not defined.
To do this just update your run script phase:
: "${EXPANDED_CODE_SIGN_IDENTITY:=-}"
./gradlew :shared:embedAndSignAppleFrameworkForXcode
Hopefully, it will help.
The answer is that you need go to 'Build Settings' -> 'Code Signing Identify' and make sure that you have a signing certificate set. You'll need to make sure you have a Team selected in 'Signing & Capabilities' as well.

WatchkitUpload Issues

We have discovered one or more issues with your recent delivery for "xxx Mobile". To process your delivery, the following issues must be corrected:
Invalid WatchKit Support - The WatchKitSupport2 folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
Invalid Executable - The executable '***.app/Watch/watchkitapp.app/PlugIns/watchkitapp Extension.appex/watchkitapp Extension' does not contain bitcode.
Once these issues have been corrected, you can then redeliver the corrected binary.
For second issue you need to enable bitcode for your app target as its required for watch apps.
Select your iOS app target- > Build Settings - > Build Options - > Enable Bitcode
Set it to true.
Refer this for App Thinning

Cocoapod fails to build on Travis-CI - "expected a type"

Objective: Build a cocoapod with CI support through travis-ci and coveralls.
Sub Objective: Keep git repo cleared of Pods/, while still including Podfile and Podfile.lock
Referenced repo: SRRandomUser
note: while indeed there exists a simple workaround solution (just removing Pod/ from my .gitignore, I ask this question because it will likely be helpful to understand this issue for future work.
Here is the situation I find myself in:
Using FSNetworking for network requests.
One of its classes, FSNData, has a class method withImage:jpegQuality:fileName: that accepts a UIImage and CGFloat as parameters.
Building this file without adding #import for UIKit and CoreGraphics results in a compiler error of expected a type with reference to the UIImage and CGFloat parameters
Locally, this is not a problem because I can add the module #imports, however since I am not committing the entirety of the Pods/ directory, these changes don't get pushed
Travis received the build and attempts to build, but since the FSNData doesn't have CoreGraphics or UIKit imported, when Travis goes to build the project, it throws the error in SRRandomUserGenerator since that class is #importing the affected FSNData class:
✗ Compile SRRandomUserGenerator.m (73 ms)
In file included from /Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/SRRandomUser/SRRandomUserAPIManager.h:10:
In file included from /Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNConnection.h:36:
/Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNData.h:42:18: error: expected a type
+ (id)withImage:(UIImage*)image jpegQuality:(CGFloat)quality fileName:(NSString*)fileName;
^
/Users/travis/build/spacedrabbit/SRRandomUser/Random Strangers/SRRandomUser/../../Pods/Headers/Public/FSNetworking/FSNData.h:42:46: error: expected a type
+ (id)withImage:(UIImage*)image jpegQuality:(CGFloat)quality fileName: (NSString*)fileName;
^
2 errors generated.
So, my questions are:
How do I either silence that warning so that the build runs anyhow or
How do I get that Pod to include the correct frameworks for building?
Many thanks in advance, SO.
I would recommend trying to search for the framework you need via Cocoapods.org. If you're using Cocoapods it usually means that it's been linked to your project (so there's really no way to silence the error, especially in this case where it seems that the framework you're using depends on other frameworks)

Cocoa - Alternatives for Webkit.framework?

Are there any alternatives for webkit.framework?
Is there for example a "ChromeKit.framework"? (Doesn't appear so from what I searched).
Is it not allowed by Apple to have competing browser frameworks available, or does no one simply care to make one?
Reason I ask is the appalling svg/canvas performance in webkit framework.
Edit: Found this: http://en.wikipedia.org/wiki/Chromium_Embedded_Framework
But there's no .framework available to just link in xcode 5. It also seems outdated (instructions). Anyone used this with xcode 5?
Edit: Well, I downloaded the 64-bit Mac CEF archive again today and this time it did not compile with the instructions I gave earlier. It was necessary to make some more modifications both to build settings and to source code (replacing some deprecated methods).
Updated answer:
Latest builds of the Chromium Embedded Framework 3 can be found here, the latest being from 10 days ago (2013/12/10). The Mac OS X 64-bit build includes a sample Xcode project for OS X 10.7 Lion which needed some modifications to compile successfuly on 10.9 Mavericks / Xcode 5 (see below). The build product cefclient.app is a simple bare-bones web browser.
The following instructions are for building the Chromium Embedded Framework and test apps on 64-bit Mac OS X 10.9 / Xcode 5 from the CEF release archive: cef_binary_3.1720.1548_macosx64.7z, currently downloadable from the CEF builds page. It may be necessary to Build after each source code change to show more issues.
Extract the 7z archive.
Open cefclient.xcodeproj/project.pbxproj in TextEdit and replace all occurrences of "10.7" with "10.9" (no quotes), and "10.6" with "10.9" (no quotes).
Open cefclient.xcodeproj in Xcode 5 and attempt to Build it (cmd-B).
In the "Issues" pane find "cefclient project" issues and click
"Validate Project Settings / Update to recommended settings" ->
Perform Changes. Xcode will update the project file.
Under "libcef_dll_wrapper" issues, select the issue involving
UINT_MAX, and replace "UINT_MAX" with "UINT32_MAX" in the code.
Under "cefclient_helper_app" issues, select the
"resource_util_mac.mm" subitem to jump to the source code, and
replace the deprecated AmIBundled() method with the
following implementation:
bool AmIBundled() { return ([NSBundle mainBundle] != nil); }
Under "cefsimple" issues, select the "cefsimple_mac.mm" subitem to
jump to the source code, and replace the deprecated
...loadNibNamed... line with:
[[NSBundle mainBundle] loadNibNamed:#"MainMenu" owner:NSApp topLevelObjects:nil];
Repeat step 6 for the "cefclient issues" -> "cefclient_mac.mm"
subitem.
It should build successfully at this point. Ignore the linker warnings; I couldn't seem to fix them and everything seems to work OK regardless.
To build the smaller (~80MB) release version of the cefclient:
Click the "All" target in the top-left corner of project window ->
select "Edit Scheme..."
Select the "Run" item in the left view, and choose Build Configuration -> Release.
The cefclient and cefsimple build products will be in the #{PROJECT_DIR}/xcodebuild/Release folder, while the CEF framework will be in #{PROJECT_DIR}/Release folder.
Not exactly plug and play, eh? Let me know if this works for you.

Unresolved external SHCreateItemFromParsingName referenced VCL.LIB / Dialogs

I have a C++ Builder application I'm porting from C++ Builder 6 to XE on Windows XP.
A number of 3rd party controls are in use as well.
I'm compiling with Dynamic RTL = False
If I compile without run time packages I get the subject error message:
[ILINK32 Error] Error: Unresolved external 'SHCreateItemFromParsingName' referenced from C:\PROGRAM FILES\EMBARCADERO\RAD STUDIO\8.0\LIB\WIN32\RELEASE\VCL.LIB|Dialogs
If I compile with run time packages the error goes away.
Googling around reveals the SHCreateItemFromParsingName has to do with common control dialogs one can invoke with WinAPI calls.
All 3rd party controls I use work in a new/separate project; thus this problem does appear to be a simple #define or something.... (not sure)
I can not find anything in my project source that would cause this. I do have an TOpenDialog and a TSaveDialog in my project that replaced an older TMC components of the same names (TntOpenDialog, TntSaveDialog) that were used in CBuilder6 to give Unicode support for the same. Converted to the ones that ship with the VCL has not resolved this problem.
There is an Embarcadero thread on this but that person appear to solve by creating #define's to build their app for WinXP and new compatibility. Under XE, I set the C++ Compiler option to target Windows XP and newer and that did not work either.
Tried adding:
"#define WINVER 0x0502"
"#define _WIN32_WINNT 0x0502"
per MSDN link here:
http://msdn.microsoft.com/en-us/library/aa383745%28v=vs.85%29.aspx
to no avail.
Other than the Open/SaveDialog components, anyone have any advise or seen this before?
OK, spent two days on this and as soon as I post it here, I found the solution.
Under the Build Configuration (right click | edit )
Under Application there is a check box "Enable runtime themes" that was unchecked.
Checked it and problem now gone.