I downloaded the class files and demo program here: http://github.com/matej/MBProgressHUD
When I try to compile the program, I get several errors. The first one appears here:
CG_EXTERN void CGPDFContextAddDocumentMetadata(CGContextRef context,
CFDataRef metadata) CG_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_0);
On the second line the error is "Expected function body after function declarator."
What's wrong with this code? How can it be fixed?
In the project build settings, change the compiler version to the system default.
If you have access to Apple's Dev Forums for the Xcode betas, you can find more info and an alternative solution at https://devforums.apple.com/message/287160#287160.
Related
ld: warning: Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler.
This warning above appeared when I installed the Firebase/Core through cocopods. And I believe it cause an error, because my project can't read the FIRApp.configure() at App deleagate in my project. I am sure I download the GoogleService-Infor.plist and put it in the right place in project, because I done it on my another project before (work properly), my another project didn't have the Objective-C categories warning.
Can anyone help me out?
The process that I've done:
Add pod 'Firebase/Core' in the project podfile, close the xcode.
Open terminal, go to the target project folder, execute pod install.
Appear a warning on terminal (Solution: just put the $(inherited) in the build setting of ALWAYS_..., then problem solve)
[!] The xxxxxx-ebooking [Debug] target overrides the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting defined in `Pods/Target Support Files/Pods-xxxxxx-ebooking/Pods-xxxxx-ebooking.debug.xcconfig'. This can lead to problems with the CocoaPods installation:
Use the $(inherited) flag, or
Remove the build settings from the target.
Appear a warning on xcode (This issues are simple, just commit the new files then warning will gone):
file:///Users/yyyyyy/Projects/xxxxxx_projects/xxxxxx-ebooking/Pods/Target%20Support%20Files/Pods-xxxxxx-ebooking/Pods-xxxxxx-ebooking.debug.xcconfig: warning: Missing file: /Users/yyyyyy/Projects/xxxxxx_projects/xxxxxx-ebooking/Pods/Target Support Files/Pods-xxxxxx-ebooking/Pods-xxxxxx-ebooking.debug.xcconfig is missing from working copy
Ignore the issues process of 3, 4, because it are easy to solve. Because the most wired warning is :
ld: warning: Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler.
Firebase Analytics has not been created. Please, configure Firebase by calling [FIRApp configure]
I did put the FIRApp.configure() in my project. But when I call FA event on some view did load, it will show this warning. I believe it is because the Objective-C warning.
see if using #nonobjc on your static variable resolve the issue
Finally I solved all bugs, thanks my friend help me to debug and stack overflow community. Here is the solution:
In the beginning I thought this warning "ld: warning: Some object files have incompatible Objective-C category definitions" caused the fail of executing the FIRApp.configure(). But it end out it are two different errors!
First issue, The FIRApp.configure() issues is because my project has error migration when swift 2.2 to 3.0. The xcode suggested me to change the old 2.2 syntax to be private method in AppDelegate:
private func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
// This method is your app’s first chance to execute code at launch time.
FIRApp.configure()
return true
}
The FIRApp.configure() will never execute because it is not AppDelegate's method. So, changed back to correct syntax will solve the issues:
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
print("Fire! willFinishLaunchingWithOptions")
return true
}
Second issue, if using the below demo syntax and your project has objective-C in third party plug-in or your code, it will cause the warning "Some object files have incompatible Objective-C...". Maybe, because syntax is old for swift 3.0 so it appear this warning.
class var applicationBuildNumber: String {
if let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
return build
}
return "Build Number Not Available"
}
If you using class function, then this warning will disappear:
class func appLocalBuild() -> String {
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String
}
I added the Parse SDK today (1.2.15) to an existing project which targets iOS7 and is built in Xcode5. I followed the instructions on https://parse.com/apps/quickstart#ios/native/existing exactly. Some things work, like creating and saving a PFObject. Certain functions however cannot be found by the compiler. For instance [PFUser enableAutomaticUser]; generates the error
AppDelegate.m:21:13: No known class method for selector 'enableAutomaticUser'
and [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions]; generates the error
AppDelegate.m:20:6: Use of undeclared identifier 'PFAnalytics'
Are the docs out of date and have these methods moved? I have tried restarting Xcode and cleaning my project. I can see the PFAnalytics.h file if I expand Parse.Framework in Xcode, and when I look at PFUser.h I can see a declaration of enableAutomaticUser;. Why can Xcode see some Parse classes and methods but not others?
My problem was that Framework Search Paths in Build Settings contained two directories, and one was invalid, resulting in this very strange behavior where some methods in Parse worked and others didn't.
I've got an app that is generating thumbnails of images at runtime. But they're not in the optimized format that Xcode creates when images are added to a project. Is there a library or a function call I can use to convert these images?
Instructions:
Download DHowett (thanks, DHowett!) code from: https://github.com/DHowett/pincrush
Unzip and rename to DHowett and place next to the XCode sample project I placed (https://www.box.com/s/7dfb3e6f430d98d933c2), and run...
If/When you build your own project from scratch, then do the following immediately after unzipping and BEFORE adding the folder to your project:
Remove all makefile files from the folder
Drag the folder to your project
To overcome compiler warning "implicit declartion of function 'pincrush' is invalid in C99", changed project setting "C Language Dialect" to "GNU89"
When building, you'll get an error "'png.h" file not found" - to fix it, add DHowett/libpng to the project's Header Search Paths
open pincrush.c and comment out the "usage" and "main" functions (you don't need them, and the first causes compilation error, the second causes link errors)
Add an external reference to crush... See below: extern void crush(const char *infilename, const char *outfilename);
You can ignore the 8 compilation warnings of "Unused Entity Issue" caused by the "NEXT" macro
You may need to remove the .git* files from the project (some annyoing warnings...)
Enjoy, good luck!
I'm using a static lib thats giving me a warning when uploading my binary for review by apple.
The method in the static lib that causes the warning(non-public selectors) is never called by me, its corresponding .h is deleted from my proj, but warning still persists.
Given that I know the method name causing the problem, is there a way for me to open/edit this .a and comment/delete the offending piece of code and then use the modified .a in my project.
I don't have access to the .a source to recompile it, and its very old and the creator of it has no contact details for me to track down.
Many Thanks,
-Cake
Quick and dirty solution: Open the .a file in a hex editor and change all instances of the name. Leave the function name the same length so that offsets in the file don't change, just change a letter or something like that. I did a quick test, adding a dummy function to a subproject we're building as a static library then tweaking the function name in the .a file (there were five instances, for what that's worth) and everything built okay. I don't see any reason it wouldn't pass the App Store check after that.
I'm really surprised the function was still there in the final build, though—I thought Dead Code Stripping was supposed to clean out any unused code. Huh.
http://opensource.apple.com/source/cctools/cctools-809/
I don't presume to get your bounty, because I haven't provided an easy solution. But yes, it in theory is possible. You have your work cut out for you.
There are several solutions, depending on your lib and project.
In your build settings :
Enable "dead code stripping" if possible : If the method is never used (even internally), the symbol will be deleted.
Use "Unexported symbol file" : Simply add the symbol into a file and it will be removed from the binary. This will work even if the symbol is used internally.
Enable "Deployment Postprocessing" and "Strip Linked Product" with "Strip Style" set to "All symbol"
(Not sure) Use "Symbols Hidden by Default". This is related to the code generation and should not affect linking, but just in case everything above failed...
No need to hack the binary files. Just turn off the compiler's "unused selectors" warning: -fno-unused-selectors.
I'm trying to include the idUDPServer component (Indy component) in a C++ Builder XE project and when I try to include the onUDPRead event (manually linking it to the component because of a known bug in C++ Builder XE).
All articles I have read so far solves this problem by manually assign the event function to the component.
In my case I can't compile because it can't recognize the TArray<System.Byte> parameter.
I have tried to include the <System.hpp> but it doesn't help.
Is there anyone that has managed to solve this issue with TArray?
Function declaration:
void __fastcall UDPServerUDPRead(TIdUDPListenerThread *AThread, TArray<System.Byte> AData, TIdSocketHandle *ABinding);
Thanks in advance...
Okay, I solved it.
I remembered that I had successfully upgraded an earlier project using the idUDPServer control without any problem. So why did that code compile and not this new one?
After some research I found that apparently Delphi (I know, it's weird. C++ Builder is written partly in Delphi) solves all types to its base form and there is an issue with the TArray<System.Data> type.
I copied the declaration from the converted project:
void __fastcall UDPServerUDPRead(TIdUDPListenerThread *AThread, TIdBytes AData, TIdSocketHandle *ABinding);
As you can see the TArray<System.Data> is replaced with TIdBytes. It compiles without any warnings or Errors. You still have to assign the event function manually although (in the Create Event).
UDPServer->OnUDPRead = &UDPServerUDPRead;
* EDIT *
Updated code TBytes to TIdBytes as Remy Lebeau - TeamB corrected me.