CCMenuItem doesn't work (Xcode 7.3~) - ios

I’m a Japanese game developer. I develop some games with cocos2d-x.
I’m confused by the following problem. So, if you any idea, please help me.
When tap the button put on a cocos2d-x layer, the button doesn’t work.
If the button be tapped, the call-back function of the button doesn’t be called.
I have found some workarounds of the problem. However, I have no idea why the problem occurs. And, I want the most suitable way, how to fix it.
The following are develop environment and mobile devices that the problem occurs.
■ Develop environment
Operating system : Mac OS X El capitan(10.11.5)
Xcode version : 7.3 - 7.3.1(7D1014)
cocos2d-x version : cocos2d-x-3.2
build config. : Test / Release
■ Mobile devices
iPhone4s(iOS 9.3.2), iPhone5(iOS 9.3), iPad mini(iOS 9.3.1)
If mobile device's condition (iOS version etc.) is different, the problem may not occur.
And, the apps built by Xcode 7.2.1 or older version have no problem. it work normally.
The problem doesn’t also occur with the apps built by Debug build mode.
I attach a sample code.
https://github.com/SeanIchikawa/SampleProject/tree/master/CCBTest
The button of the layer is made by ccbi (ccbi = cocos builder file).
The call-back function is referenced to the button by "Selector" in the ccbi file.
■ About the sample Xcode project
Xcode Project name : CCBTest
ccbi file: Resources/simple.ccbi
Class file (written about layer) : Classes/SimpleView.h
If you any idea, please give me.
Thank you for reading my question.

The only way I've found at the moment to work it around is to downgrade Xcode to 7.2.1, having exactly the same problem but with CCButton instead.
Older Xcode versions can be downloaded from here: https://developer.apple.com/downloads/

This issue only occur if you are targeting a 32-bit architecture device with -Os optimization.
Set the optimization to -O1 in your release build could walk around this issue for now.

Related

How to Using Xcode, Appium to Test App on iPhone from MacBook

I have a question regarding the title above. I try surfing the internet for almost 2 weeks, but my issues were not solved.
I have an iPhone (iOS 15) and MacBook (macOS 13.6.1), want use XCode 13 to test the app. I got instructions from the Leapwork guy, to list how to do it. My colleague wants to test an app on iPhone, and she asks me to setup it up for her.
But I am facing a few errors which I don't know what are and how to solve because this is my first time playing it.
Here link to the document I manage success following the step from 1 to 8. I’m afraid to step 9 I did something wrong because it asked me to change a few things may I miss out.
iOS Instruction
The error that I have on XCode is
Building for iOS, but the linked and embedded framework 'RoutingHTTPServer.framework' was build for iOS + iOS Simulator
'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'
Double-quoted include "HTTPConnection.h" in framework header, expected angle-bracketed instead.
Could not build module 'RoutingHTTPServer'
I'm running Appium but not sure need to configure it or not.
I hope anyone knows about this or has been through a similar situation, please help and guide me on the correct path. I think I already lost. :(
Thanks.

Xcode Error on Simulator: MGIsDeviceOneOfType is not supported on this platform

I have a very simple application with a single view, containing several UILabels. Upon running in Simulator, the Xcode console returns the error:
libMobileGestalt MobileGestalt.c:875: MGIsDeviceOneOfType is not supported on this platform.
The Simulator itself just shows a white screen. I've also tried running it on a developer device with the same white screen. I've searched documentation but can't find any reference to MGIsDeviceOneOfType.
The application is written in Swift in Xcode 10 beta on macOS 10.14. I am attempting to run it on the iPhone 7-X Simulators, as well as a development iPhone 7, all running the target software (12.0).
MobileGestalt
The libMobileGestalt.dylib provides a central repository for all of the iOS's properties. It can be analogous to OS X's Gestalt, which is part of CoreServices. OS X's Gestalt is documented for example Gestalt Manager and has been deprecated as of 10.8. MobileGestalt is entirely undocumented by Apple as it is a private library.
MobileGestalt allows for the testing of system properties that may or may not be compatible on different simulators.
Quite a few system processes and apps in iOS rely on MobileGestalt, which is located at /usr/lib/libMobileGestalt.dylib. It's more of a basic library, but its exposed APIs follow the Apple framework conventions and uses the MG API prefix for example MGIsDeviceOneOfType.
If you look for MobileGestalt on the iOS filesystem you won't find it - like all private frameworks and libraries, it has been prelinked into the /System/Library/Caches/...etc. If you like hacking and pen-testing then you can use tools to extract it.
MobileGestalt provides plenty of information - around 200 or so queries - on various aspects of the system. Here are a few.
libMobileGestalt.dylib
//Answers to MG queries
MGCopyAnswer(#"5MSZn7w3nnJp22VbpqaxLQ");
MGCopyAnswer(#"7mV26K/1a+wTtqiunvHMUQ");
MGCopyAnswer(#"BasebandAPTimeSync");
MGCopyAnswer(#"BasebandPostponementStatus");
MGCopyAnswer(#"BasebandPostponementStatusBlob");
MGCopyAnswer(#"BasebandSecurityInfoBlob");
MGCopyAnswer(#"BasebandStatus");
MGCopyAnswer(#"BuildVersion");
MGCopyAnswer(#"CoreRoutineCapability");
MGCopyAnswer(#"DeviceClass");
MGCopyAnswer(#"DeviceClassNumber");
MGCopyAnswer(#"DeviceName");
MGCopyAnswer(#"DeviceSupports1080p");
MGCopyAnswer(#"DeviceSupports720p");
MGCopyAnswer(#"DiskUsage");
MGCopyAnswer(#"GSDeviceName");
MGCopyAnswer(#"HWModelStr");
MGCopyAnswer(#"HasBaseband");
MGCopyAnswer(#"InternalBuild");
MGCopyAnswer(#"InverseDeviceID");
MGCopyAnswer(#"IsSimulator");
MGCopyAnswer(#"MLBSerialNumber");
MGCopyAnswer(#"MaxH264PlaybackLevel");
MGCopyAnswer(#"MinimumSupportediTunesVersion");
MGCopyAnswer(#"PasswordConfigured");
MGCopyAnswer(#"PasswordProtected");
MGCopyAnswer(#"ProductType");
MGCopyAnswer(#"ProductVersion");
MGCopyAnswer(#"RegionCode");
MGCopyAnswer(#"RegionalBehaviorNTSC");
MGCopyAnswer(#"RegionalBehaviorNoPasscodeLocationTiles");
MGCopyAnswer(#"ReleaseType");
MGCopyAnswer(#"SIMStatus");
There are hundreds more e.g. AirplaneMode, MobileEquipmentIdentifier, etc.
MobileGestalt maintains a table of OSType selector codes.
for example c:890 in the message: libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform. In this case MGIsDeviceOneOfType is a method/property of the MobileGestalt library.
Instead of checking the simulator version there is a separate selector for directly querying the capabilities of the simulator. The messages most likely indicate incompatibilities between simulator versions and Xcode versions and/or unsupported APIs on the simulator.
I've successfully dropped it with the disabling of the project garbage.
Go to <Name of your Project>->Scheme->Edit Scheme Then go to Run (menu to the left side) and add the following environment variable:
Name:OS_ACTIVITY_MODE, Value: disable
in my case: check your app delegate for method - didFinishLaunching. I had private and get the error. After remove "private" everything works fine
I just installed Xcode 10 Beta and had the same problem. Ran Xcode 9.4.1 and the problem went away.
This error will only occur when testing/debugging on simulators.
The newer the simulator the better.
Case: I run simulator iPhone 8 plus I got this message in the debugger.
Solution: I changed to a newer simulator no error message in the debugger.
Ran into this when opening some project from GitHub on Xcode 10.0.
The pragmatic solution was: just hit 'Continue program execution' multiple times and probably disable your exception breakpoint. Apparently the exception was recoverable.
It's not a real solution but it was good enough for me at that point.
In my case, the Target's Deployment Target was at iOS 8. When I pushed it up to iOS 10.3, it ran fine, both on the Simulator and the device.
Am seeing this problem. Using Xcode 10.1. Created a brand new project - doesn't do anything except show a white screen. Discovered it was showing up on simulator for older devices. For example, iPad Pro (12.9 inch) and iPad Pro (12.9 inch) (2nd generation) show the problem, but problem is gone for iPad Pro (12.9 inch) (3rd generation). Does not show up for iPhone XR simulator.
Basically seems annoying.
If you have fonts provided by the app, you need to add to Info.plist
And check if the file have the Target Membership selected
I had the same issue, but with MapKit, where a MapView did not show up, just the white screen and the same error, MGIsDeviceOneOfType is not supported on this platform.
Solved it by fixing "Ambiguous layout" warnings tied to the MapView object. Now it's working perfectly fine, and the errors went away.
The regular way when strange errors happens helped:
1) Clean project;
2) Shut down simulator;
3) Reinstall pods.
Xcode 10.
For me, with the simulator in question in focus, I selected Hardware->Erase all content and settings.
After the simulator restarted, launching my app worked again, as expected.
I went to XCode -> Preferences -> Components
Ticked all the simulators and the check box to install updates automatically, and then "check and Install now" and went away for a few hours while they all updated.
Now the problem is gone - so in fact, it's as mentioned. New XCode with Old - non-updated simulators.
What worked for me was to change within general > Deployment Info > Main Interface to CDVLaunchScreen and do the same within general > App Icons and Launch Images > Launch Screen File to CDVLaunchScreen as well.
I come from Ionic, so this might not be a problem for those who develop in Swift / Objective-C.
I have recently updated to Xcode 10.2 and when I tried to run a project created in earlier version, Same error occurred.
The problem was that simulator was running before updating Xcode.
Solution was very simple for me to quit Simulator and restart so that it can get the new changes. I don't think the model of the simulator (iPhone SE or iPhone X) matters. You just need to restart your simulator for it to take effect of new update.
I would recommend to quit both Xcode and simulator and restart your Mac.
I got this error by calling .sync on the main queue which caused a deadlock (DispatchQueue.main.sync {}). I meant to call .async.
I got this error, when trying to read a json file which is inside my project and it returned nil, due to that i got this error.
I got nil because of some spelling mistake in the font name, that json file was holding the font names, after copy pasting the font name i got data and the error fixed.
I tried allmost all of the solutions given above, nothing worked, So debug with patience, you will get to know which is causing this error and in some bad time xcode will play in our life :)
I was facing same problem but I've successfully dropped it with below things:
Shutdown simulator,
Shutdown Xcode,
Re-open Xcode and simulator
I hope it will help.

EXC_BAD_ACCESS when trying to run Unity game on iOS simulator

I'm usually not a Mac/Xcode user, please forgive me for incorrect terms or understandings.
I have a 2D Unity game which I can successfully build and run on Android and Windows Phone devices/emulators. When building for iOS, I can successfully create the Xcode project, open it and build the app in there. The only change in the iOS-specific player settings I made was to set SDK Version to Simulator SDK.
However, when trying to run it inside the simulator, the splash screen appears, then Xcode pauses on something that looks like an assemby file with an error message: Thread 1: EXC_BAD_ACCESS (code=1, address=0x4).
As I had no idea on what to do, I started stripping down my project (in Unity) until I had no more gameObjects but the camera left on the start scene. Also, I removed all other scenes from the build. The only thing that changed was that above error message now seems to appear on another assembly file.
What could be the issue here? How should I investigate further?
Update
This is the stacktrace:
Update 2
I've created a new blank Unity project, and I get the exactly same error there. The problem seems to be related to Unity or my machine, not the app itself.
Workaround
After days of researching, I still couldn't resolve the issue and finally built for a real devices instead of the simulator. Since I don't own one, I "blindly" submitted the result to the app store, and it got accepted.
For me, that's the proof that the issue is solely related to the combination of Unity and the iOS simulator, i.e. that those two don't work together reliably.
On the other hand, it seems relatively safe to assume that an app will work on iOS if it's been successfully tested on Android, Windows Phone and the default player. Of course, unless iOS-specific features are implemented.
I only know one reason, that leads to this behaviour (device builds work, but simulator builds won't).
=> This could happen, when using native iOS code / plugins
To fix that, you'll have to modify the <path-to-xcode-project>/Libraries/RegisterMonoModules.cpp file, cause somehow Unity does not register those classes/methods for the simulator.
Just look for #if !(TARGET_IPHONE_SIMULATOR) defines and shift them to have all your plugins included, also in the simulator. There will be some move mono_dl_register_symbol() that you'll need.

Building with iOS7 produces iOS6 looking widgets

After moving to XCode 5 and the iOS7 base SDK, some of the UI widgets in my app still look like iOS6-style (gradients, frames) on iOS7 devices. This doesn't happen on the equivalent emulator for iOS7. This also doesn't happen for all widgets, UIDocumentInteractionController's popup looks like iOS7 on device, but UIPopoverController doesn't. The keyboard for renaming a file also shows this discrepancy between emulator and device.
How does iOS determine the visual style of UI elements? Is it based on a statically linked library or something determined at runtime? I've tried purging the app from the device completely, but no change.
Emulator for retina iPad: UIPopoverController
iPad 3rd gen with iOS 7: UIPopoverController
The code in this case is fairly straightforward, no customization of the rendering or layout.
self.poController = [[UIPopoverController alloc] initWithContentViewController:audioCopyController];
[audioCopyController showDoneButton:NO];
audioCopyController.view.frame = CGRectMake(0,0,350,250);
_poController.popoverContentSize = audioCopyController.view.bounds.size;
_poController.delegate = self;
[_poController presentPopoverFromRect:view.audiocopyButton.frame
inView:view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
Thanks for the help in advance.
Check you Project config file and Target config file.
It is probably set with an iOS 6.X base SDK.
For this:
Go to your project config file in Xcode 5
Click the Build Settings tab
Edit the base SDK field to switch it to iOS 7.
Sometimes, we've experienced issues with Xcode not taking the current setting into account.
Changing it and compiling helps it understand that it needs to be changed.
Make sure you configure this correctly for your Project config and each and every target config file you run this from.
You might well have 2 different targets for simulator and for your devices.
Hope this helps
Regards
David
Ok, I found out what the problem was. David's suggestion got me thinking.
I am maintaining multiple apps at the same time, and one of them is quite old. The new Interface Builder in XCode5 breaks the transparency for a lot of the fields in the old app so I was keeping XCode4 in a separate installation folder alongside of XCode5. It seems that somehow my XCode5 project was still pointing at the SDK folders of XCode4 (not sure how this was possible, looking at the actual linker command line would probably shed some light), so after deleting XCode4's 6.1 SDK folder from my machine, a clean build with XCode 5 produced the correct iOS 7-looking widgets in my iOS-supported app.
The moral of the story is, be very careful with multiple XCode/SDK installations on the same machine. Hopefully this can help other folks who may be trying something similar to provide support for legacy apps.

iOS 5.1 crashes when using collections view

I am trying to use collection view and I want to support 5.1. I am not using story board. I have added collectionview to my view controller. I am identifying the version and opening collection view if its 6.0 or higher else opening another view controller. When I run my application in 5.1 it immediately crashes with error :
Symbol not found: _UICollectionElementKindSectionHeader
I have seen the link below it only describes the case when you use story board.
How to use UICollectionViewController in storyboard while still supporting ios 5.1?
Any help would be appreciated.
Thanks
Are you sure you've set your deployment target to iOS 5.1 in your app target in your project?
That should cause the following:
"...Framework APIs that are unavailable in earlier versions will be weak-linked..."
(from the quick help of IPHONEOS_DEPLOYMENT_TARGET).
If it's crashing immediately upon launch, it sounds like it's not being weak-linked.
If you're sure you've set a deployment target of iOS 5.1, you could try forcing the entire UIKit.framework to be weak-linked to troubleshoot the issue. To do that, you mark it as Optional as opposed to Required in the Linked Frameworks and Libraries section:
FWIW, I've been able to successfully do what you're describing in a Mac OS X application: I have an app built against the latest SDK, and at runtime, check the version of OS X and load different nibs. In the nibs for later versions of OS X, I can make use of UI elements that did not exist in earlier versions of OS X. Provided your app is nib-based, I can't see why you wouldn't be able to do the same in iOS. (Note that if you're using storyboards, that's a different story).
Here's an example project of how to set it up:
http://www.markdouma.com/developer/CollectionViewFinagler.zip
UICollectionView is not supported in iOS5. You can only use it with iOS6 apps. Sorry, but you are out of luck with it.
Here is an open source project that should help you out though, as it is defined:
Open Source, 100% API compatible replacement of UICollectionView for
iOS4.3+

Resources