subclass in iOS run successfully in simulator but failed in iPhone

Issue #208 new
iosdeveloper
created an issue

Hi Ronald,

Thanks for your great job. I'm trying to use pyobjc in a iOS project, following code can run in simulator:

import objc
from Foundation import CGRectMake
UIApplication = ObjCClass("UIApplication")
UIColor = objc.lookUpClass('UIColor')
UIView = objc.lookUpClass("UIView")

rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
rc = CGRectMake(30,70,50,60)

class MyView(UIView):
    def initWithFrame_(self, frame):
        self = UIView.alloc().initWithFrame_(frame)
        self._.backgroundColor = UIColor.redColor()
        return self

aView = MyView.alloc().initWithFrame_(rc);
rootVC._.view.addSubview_(aView)

But failed in iPhone, crashe in function initWithFrame, any idea?

exception.JPG

Comments (5)

  1. Ronald Oussoren repo owner

    What version of PyObjC do you use?

    To be blunt, PyObjC is not supported on iOS and this repository does not contain the low-level support needed to be able to use the project on ARM systems.

    BTW. Your code fragment is not complete, it uses "ObjCClass" without defining or importing it.

  2. Ronald Oussoren repo owner

    There's too little information here to reproduce the problem.

    1) Which version of PyObjC is used?

    2) How is this version built for use on iOS?

    3) What python version and how is that built for iOS?

  3. iosdeveloper reporter

    1) Which version of PyObjC is used? 3.0

    2) How is this version built for use on iOS? 3) What python version and how is that built for iOS? 3.5.1, I'm going to create a testing project to let you reproduce this issue.

  4. Log in to comment