SDWebImage on iOS 8.1 weird compile error - ios

When I try to run project on real device (iPhone 5 and 5S with iOS 8.1) I get following compiler errors:
// ARC Semantic Issue - myPath/SDWebImage/UIImage+GIF.m:26:42: No visible #interface for 'UIImage' declares the selector 'initWithData:'
animatedImage = [[UIImage alloc] initWithData:data];
// ARC Semantic Issue - myPath/SDWebImage/UIImage+GIF.m:47:34: No known class method for selector 'animatedImageWithImages:duration:'
animatedImage = [UIImage animatedImageWithImages:images duration:duration];
// ARC Semantic Issue - myPath/SDWebImage/UIImage+GIF.m:155:21: No known class method for selector 'animatedImageWithImages:duration:'
return [UIImage animatedImageWithImages:scaledImages duration:self.duration];
My project was working normally until this morning. I changed nothing, just tried to debug on real device. The strangest part of that is I can run/debug on emulator (on any iPhone device with iOS 8) without any error.
When I downgrade deployment target from 8.1 to 8, XCode can successfully build and run the project for emulator and real device.
I tried completely removing SDWebImage and adding it back but didn't solve the problem.
I am using XCode 6.1 (Swift) and iOS 8.1 SDK on my project.
What might be causing the problem that suddenly appeared?

As has been said on other questions, the new "ModuleCache" directory within DerivedData has been responsible for many of these problems.
Here's the path:
/Users/[user]/Library/Developer/Xcode/DerivedData/ModuleCache
Simply delete the module cache, or the entire derived data directory as many have been doing on a daily basis for the last few iOS SDK iterations.
I came here looking for a different answer to a similar problem since this solution isn't fixing my current problem, but I figured I would share this as it will fix many of these.

Related

Switching to Xcode 10 causes `UserNotifications.framekwor dyld: Library not loaded crash` for iOS9

We have an app that is working properly with the UserNotification.framework being linked as required framework in Xcode 9. Everything works smooth here.
Now we are switching to Xcode 10. But there linking this framework as required leads to
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /var/containers/Bundle/Application/1D41BD68-9B88-4D5D-B7AB-0D1C31979964/App.app/App
Reason: image not found
If I switch it to optional push notification (via Intercom) won't work anymore.
What is the reason? How can we fix that? Why is it even working in Xcode 9?
Update #1
using
#import UserNotification
does not fix it
Update #2
Its fixed by importing and using it actually (in AppDelegate.m) like this
UNNotificationRequest* unr = [UNNotificationRequest alloc];
unr = nil;
Why?
It is related to the same issue I have experienced already.
CABTMidiCentralViewController used in Storyboard only working if using code reference
Update #3
More generic question
Xcode sometimes removes linked library
UserNotification SDK is available on iOS 10+, Try to update the deployment Target to iOS 10 +
Can your please try removing the framework and adding that again ? I just created a new project this framework added in Xcode 10 and was able to run in the device without any errors.

CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/ .... '

I get this error in the debugger everytime core data is used (so if I make 3 calls I get the warning 3 times).
CoreData: annotation: Failed to load optimized model at path '/var/containers/Bundle/Application/0B6C2326-D8D5-47B3-8C68-7693C16A0806/liveDemo.app/liveDemo.momd/liveDemo.omo'
It does not cause any instant problem, but whilst they add up, it gradually slows down the app until it crashes with a NSException (it's irrelevant what the user does at the time, it will just lag more and more then come to a crash at whatever point in the app).
I have tested the app on 3 devices (iPhone 7+ - iOS 11, iPhone 7 - iOS 11, iPad Aid - iOS 10.3) and it ONLY occurs on the iPad. However when I started the project one of the phones had a version of iOS 10 installed and it did not cause any issues so although I can't fully exclude it, it seems unlikely it's the OS version to blame.
Steps tried
Uninstall and install app, so the device clears core data file, also tried restarting with and without the app installed - FAILED
Remove and rewrite the Scheme in Xcode - FAILED
Recreate the NSManagedObjectSubclass of the datamodel - FAILED
Has anyone encountered anything similar with recent versions of Xcode and managed to fix it? This is a 2 year old similar problem, but none of the answers have helped.
So, after a few days I have managed to solve it. I'm not familiar enough with the insides of Xcode, but all I had to do was rewrite the CoreData Model. Best to make a back up before trying this!
Take a screenshot of current attributes and delete the CoreDataModel ( .xcdatamodeld file)
Add a new file to project (Data Model template)
Write old attributes
Recompile and build
My assumption would be that the problem was caused after migrating a project started in Xcode 8 (written in Swift 3) to Xcode 9 (upgraded to Swift 4). It had no problem with devices running iOS 11 (same upgrade level as Xcode 9), but found it to consistently cause lag and eventually crashes in older iOS versions.
I don't understand why simply modifying file properties did not fix it, but I'm happy to have fixed it and move on.

Swinject giving EXC_BAD_ACCESS code = 2 within a simple project. Working if compiled with Xcode 9 beta

I have a minimal working project which if compiled with Xcode 8.3.3 gives me EXC_BAD_ACCESS. The project is a simple VIPER implementation of modules. Swinject is being used to create the module itself along with all the dependencies.
How I solved the problem (or thought I solved):
By removing references of the SwinjectBug directory and re-adding solved the problem a few days ago. However, this is not working anymore.
What still solves the problem:
Compiling and running in Xcode 9-beta with the same iPhone model and iOS version works perfectly. [This observation was probably wrong. Not working all the time]
If I force cast output as! SplashScreenPresenter, the code works fine.
Possible scenarios:
There is a bug in Xcode 8.3.3 which is solved in Xcode 9
But if the above is true, it should have failed for other modules but that is not the case.
Something is wrong in the way I am using Swinject.
You may compile and run the project.
I am using:
iOS 10.3.1 on iPhone 6s 64GB
Xcode 8.3.3
The EXC_BAD_ACCESS occurs in SplashViewController on calling viewIsReady on output
override func viewDidLoad() {
super.viewDidLoad()
output.viewIsReady()
}

EXC_BAD_ACCESS Using gmaps sdk 1.9.0, Xcode 6.4, running on 8.3 device

I have 2 projects working with google maps sdk, they are currently in the Appstore.
Things to have in mind:
Gmaps sdk version 1.9.0 installed via cocoapods
Xcode version 6.4
Deployment target 7.1
Device: iPhone 4s with 8.3.0
Today I've opened Xcode as usual with the first project, tried to compile and debug on the iPhone and I sometimes get a EXC_BAD_ACCESS (code=1...) crash on the app and sometime get EXC_BAD_ACCESS (code=EXC_ARM_DA_ALING...), no stack trace in here, but always on main.m:
return UIApplicationMain(argc, argv, nil, NSStringFromClass([TGPAppDelegate class]));
Seeing the first thread I've discovered that this is error is related to google maps:
Tried the following:
Updating the pod (didn't work)
Replaced my code with the sample code on gmaps sdk page (didn't work)*
I have read something about auto layout, disabled (didn't work)
The weird part is that I also:
Tried in an iPhone 6 with 8.4 (DID work)
Tried in an iPhone 6 with 8.3 (DID work)
Both project are in an early beta state, so I don't if the are any real user have this problem but I'm worried that some users wont be able to use the apps because of this.
I couldn't find too much information over the internet and I don't even know where to look, is there any reported known error regarding this?, anyone else with the same issue?
Here is the sample code I'm using:
-(void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.80948
longitude:5.965699
zoom:2];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.view = mapView;
}
EDIT 1:
Doing more tests, found out that the problem appears only when debugging (attaching the debugger when running the app), if you run the app from the iPhone and after that you attach the debugger to the process, everything runs ok, I mean, if the map tries to render when the debugger is attached then you will get the exc_bad_access, it's a debugger error then?, I'm confused
EDIT 2:
This in answered in here , thanks Dave
The answer to this is not mine, this in answered in here , thanks Dave, I' m just quoting him so anyone can see the answer.
I've found the root of the problem and have a workaround:
The problem seems to be triggered by OpenGL ES Frame Capture in XCode;
I'm guessing this problem started when Apple added Metal to the mix as
of XCode 6.4/iOS 8.3, perhaps somehow adversely affecting the entire
frame capture debugging system.
The workaround:
EDIT: I've found the root of the problem and have a workaround:
The problem seems to be triggered by OpenGL ES Frame Capture in XCode;
I'm guessing this problem started when Apple added Metal to the mix as
of XCode 6.4/iOS 8.3, perhaps somehow adversely affecting the entire
frame capture debugging system.
The workaround:
In XCode, go to Product > Scheme > Edit Scheme...
Select the "Run" Tab on the left.
Select the "Options" sub-tab on the top.
Change "GPU Frame Capture" from "Automatically Enabled" or "OpenGL ES" to either "Metal" or "Disabled".
This disables OpenGL ES frame capture, which isn't great, but allows
you to continue debugging your builds.
Not sure if this issue is Apple's or Google's but I'll be posting bug
reports to both. Happy coding!
Same problem here with MKMapView.
Solution is rollback to (run side-by-side) Xcode 6.3.2.
http://adcdownload.apple.com/Developer_Tools/Xcode_6.3.2/Xcode_6.3.2.dmg
Also switch Command Line Tools to 6.3.2 in Preference -> Locations
i had the exact same problem:
iphone 4 -> iOs 7 (working)
xcode simulator (working)
iphone 5s -> iOs 8.3 (NOT working EXC_BAD_ACCESS)
SOLUTION: i updated my iphone to iOs 8.4 and the problem is gone, maps are loading.
hope it helps

SDWebImage ARM 64 Issue

I have been using the SDWebImage for a while in my project and it has been working great. Until, I have upgraded to Xcode 6.0.1 recently and suddenly, everything is a chaos. Everytime, I try to call the method:
UIImageView setImageWithURL:placeholderImage
I am getting the unrecognized selector sent to instance crash. I have googled it a bit and the only solution that I can come across is this, which in turns gets me to the issue # 494. Now, iPhone 5S or not, it's crashing every time. Here are the related settings of my project:
Any idea, what I am missing here?

Resources