Hi
My latest update (Prison Escape v1.1.0) has just been approved. When downloaded, it works fine with iOS4 - iAds are popping up where they should rotate to the correct orientation when turning the device.
On the iPad and iPhone running iOS3 however as soon as you move the device CRASH So long as I donāt move the device, the game runs well.
I used the latest iAd plugin weak linked in Xcode in the hope that the game would still run on iOS3.
Can anyone point me in the direction of a quick fix before the reviewers rip me to shreds!
Sounds to me like during the autorotation the code is assuming that the iAd classes will be available and is just blindly accessing them. If this assumption is true, you have 2 solutions:
change the code to properly detect and work with a weak linked framework (NSClassFromString, respondsToSelector:, etc)
(a bit more hackish but it will work) From Unity, get iOS version and if less than 4.0 dont allow anything iAd related to get called on the native side.
I am getting the general sig fault also. After testing this afternoon the problem is definitely related to auto rotating the iAd in the following code:
function Update () {
if (iPhoneInput.orientation == iPhoneOrientation.LandscapeLeft) {
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft;
iAd4Unity.RotateTo(iAd4Unity.UIOrientation.LandscapeRight);
}
if (iPhoneInput.orientation == iPhoneOrientation.LandscapeRight) {
iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight;
iAd4Unity.RotateTo(iAd4Unity.UIOrientation.LandscapeLeft);
}
}
@Prime31: The problem is as you suggest. Unfortunately my coding skills are cr@p to say the least Any further help you could offer in the way of an idiots step by step guide through either of your 2 solutions would be greatly appreciated.
As a matter of fact, I was doing some research on how to help with weak-linking on the next version of the plugin.
@prime31: How low can you go? First attacking KVO compliance, screaming left and right how āhackishā this method is (Iād be very surprised if Mono-to-Native were any faster than straight linking)⦠and now this !?
Thatās very low.
In any case, kudos to you, you did do a good job supporting Unity 3 and iPhone 1.7 Pro users.
@jonaphin, there are a couple ways to weak link iAd:
open the target properties (double click target) and go to general tab (see attached screenshot) and just change it from Required to Weak
add compiler flag -weak_framework to target build
As for āscreaming left and rightā I donāt think I would go that far. Iād more call it telling it like it is. Calling a function by setting an NSUserDefault is a hack no matter what way you bake it. And as for speed, you should benchmark it. You might be surprised.
Thanks for the weak-linking tip. What Iām really after is the āmagicā touch that will make that happen automatically. But this too shall come.
The coding side of the weak-linking should actually already be handled by the plugin.
@haggis: you may want to try changing the ārequiredā to āweakā for the iad.framework and see how that goes.
@jonaphin, you should be able to get at it with good old AppleScript. Check the Xcode dictionary. @haggis may need to do a conditional check in the rotation logic in addition to the weak linking depending on how it was done.
Edit: just noticed you mentioned the coding side is already done so disregard above statement.
@Prime31: Just had a quick look at your website - nice range of plugins I will boomark that now.
@Jonaphin: Your iAd plugin is working a treat on iOS4 making a revenue of $185 on the first day!
I have weak linked the version which is currently in the App store and I had tested a couple of ways of doing this:
Changing the ārequiredā to āweakā in the iAd framework.
Adding compiler flag -weak_framework to target build which was suggested in another post in the forum.
Both of these solutions work so long as you do not rotate the device therefore it looks like itās a conditional statement for āiAd4Unity.RotateTo(iAd4Unity.UIOrientation.LandscapeRight)ā that is needed and thatās where I get stuck.
I have had a look through the forum for reference to detecting the iOS version but canāt find anything so far.
Again thank you for all your help so far - loving the healthy banter by the way
never use the system verison
if the code does not handle it correctly through checking selector presence and class presence, apple will likely reject it anyway if you attempt to do something on pre ios4 just a single time if it requires ios 4
Iāve started researching what could be triggering the crash on pre-iOS 4.0
Iāll do my best to take this into account on the next version of the plugin, which I will try to release next week.